/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('cams', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddChatappPhoneNumberRequest {
  cc?: string(name='Cc', description='You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.

This parameter is required.', example='86'),
  custSpaceId?: string(name='CustSpaceId', description='Adds a phone number for a WhatsApp Business account (WABA).

This parameter is required.', example='93928389****'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='AddChatappPhoneNumber

This parameter is required.', example='1380000****'),
  preValidateId?: string(name='PreValidateId', description='cams:ChatappPhoneNumberRegister', example='1020****', deprecated=true),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  verifiedName?: string(name='VerifiedName', description='Private

This parameter is required.', example='Alibaba'),
}

model AddChatappPhoneNumberResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='com.alicom.access.oxs.client.channel.aliyun.flow.AyFlowExecuteService', example='http://pop_access_slb_sgvpc/#vpc'),
  code?: string(name='Code', description='The phone number.', example='OK'),
  message?: string(name='Message', description='com.alicom.access.oxs.client.channel.aliyun.flow.dto.AyCommonApiRequest', example='None'),
  requestId?: string(name='RequestId', description='formData', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', description='13800000000', example='false'),
}

model AddChatappPhoneNumberResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddChatappPhoneNumberResponseBody(name='body'),
}

/**
 * @summary Adds a phone number for a WhatsApp Business account (WABA).
 *
 * @param request AddChatappPhoneNumberRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddChatappPhoneNumberResponse
 */
async function addChatappPhoneNumberWithOptions(request: AddChatappPhoneNumberRequest, runtime: $RuntimeOptions): AddChatappPhoneNumberResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.cc)) {
    query['Cc'] = request.cc;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.preValidateId)) {
    query['PreValidateId'] = request.preValidateId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.verifiedName)) {
    query['VerifiedName'] = request.verifiedName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'AddChatappPhoneNumber',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds a phone number for a WhatsApp Business account (WABA).
 *
 * @param request AddChatappPhoneNumberRequest
 * @return AddChatappPhoneNumberResponse
 */
async function addChatappPhoneNumber(request: AddChatappPhoneNumberRequest): AddChatappPhoneNumberResponse {
  var runtime = new $RuntimeOptions{};
  return addChatappPhoneNumberWithOptions(request, runtime);
}

model BeeBotAssociateRequest {
  chatBotInstanceId?: string(name='ChatBotInstanceId', description='The ID of a bot instance.

This parameter is required.', example='1'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='293483938849493'),
  isvCode?: string(name='IsvCode', description='The ISV verification code, which is used to verify whether the user is authorized by ISV.', example='ksiekdki39ksks93939'),
  perspective?: [ string ](name='Perspective', description='The list of codes for answers from different perspectives.'),
  recommendNum?: int32(name='RecommendNum', description='The number of recommended questions. The value ranges from 1 to 10.', example='3'),
  sessionId?: string(name='SessionId', description='The ID of the session, which is used to identify the session and store context information in the session.', example='2334324234'),
  utterance?: string(name='Utterance', description='The input of the visitor.', example='hello'),
}

model BeeBotAssociateShrinkRequest {
  chatBotInstanceId?: string(name='ChatBotInstanceId', description='The ID of a bot instance.

This parameter is required.', example='1'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='293483938849493'),
  isvCode?: string(name='IsvCode', description='The ISV verification code, which is used to verify whether the user is authorized by ISV.', example='ksiekdki39ksks93939'),
  perspectiveShrink?: string(name='Perspective', description='The list of codes for answers from different perspectives.'),
  recommendNum?: int32(name='RecommendNum', description='The number of recommended questions. The value ranges from 1 to 10.', example='3'),
  sessionId?: string(name='SessionId', description='The ID of the session, which is used to identify the session and store context information in the session.', example='2334324234'),
  utterance?: string(name='Utterance', description='The input of the visitor.', example='hello'),
}

model BeeBotAssociateResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The access denied for detailed information.', example='None'),
  code?: string(name='Code', description='If OK is returned, the request is successful.', example='OK'),
  data?: {
    associate?: [ 
      {
        meta?: string(name='Meta', description='The metadata.', example='{}'),
        title?: string(name='Title', description='The title of the related question.', example='Policy on Withdrawal of Housing Provident Fund'),
      }
    ](name='Associate', description='The list of associated recommendations.'),
    messageId?: string(name='MessageId', description='The ID of the response message.', example='1eb47d7a1706429081e90c83c62c2f00'),
    sessionId?: string(name='SessionId', description='The ID of the session.', example='93f11165a2a24289a6f869760e8cb3f3'),
  }(name='Data', description='The data returned.'),
  message?: string(name='Message', description='The error message returned.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model BeeBotAssociateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BeeBotAssociateResponseBody(name='body'),
}

/**
 * @summary Associates FAQs in the knowledge base.
 *
 * @description You can call this operation up to 100 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq BeeBotAssociateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BeeBotAssociateResponse
 */
async function beeBotAssociateWithOptions(tmpReq: BeeBotAssociateRequest, runtime: $RuntimeOptions): BeeBotAssociateResponse {
  tmpReq.validate();
  var request = new BeeBotAssociateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.perspective)) {
    request.perspectiveShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.perspective, 'Perspective', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.chatBotInstanceId)) {
    body['ChatBotInstanceId'] = request.chatBotInstanceId;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.isvCode)) {
    body['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.perspectiveShrink)) {
    body['Perspective'] = request.perspectiveShrink;
  }
  if (!$isNull(request.recommendNum)) {
    body['RecommendNum'] = request.recommendNum;
  }
  if (!$isNull(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!$isNull(request.utterance)) {
    body['Utterance'] = request.utterance;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'BeeBotAssociate',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Associates FAQs in the knowledge base.
 *
 * @description You can call this operation up to 100 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request BeeBotAssociateRequest
 * @return BeeBotAssociateResponse
 */
async function beeBotAssociate(request: BeeBotAssociateRequest): BeeBotAssociateResponse {
  var runtime = new $RuntimeOptions{};
  return beeBotAssociateWithOptions(request, runtime);
}

model BeeBotChatRequest {
  chatBotInstanceId?: string(name='ChatBotInstanceId', description='Indicates whether the answer is in plain text or rich text.

This parameter is required.', example='1'),
  custSpaceId?: string(name='CustSpaceId', description='The metadata.', example='293483938849493'),
  intentName?: string(name='IntentName', description='The source of the answer.', example='intent'),
  isvCode?: string(name='IsvCode', description='The source of the answer.', example='ksiekdki39ksks93939'),
  knowledgeId?: string(name='KnowledgeId', description='The hit statement.', example='1'),
  perspective?: [ string ](name='Perspective', description='Beijing'),
  senderId?: string(name='SenderId', description='The information about the slot.', example='861500000000'),
  senderNick?: string(name='SenderNick', description='Beijing', example='nick'),
  sessionId?: string(name='SessionId', description='The title of the related knowledge.', example='en'),
  utterance?: string(name='Utterance', description='The title of the hit question.

This parameter is required.', example='659216218162179'),
  vendorParam?: map[string]any(name='VendorParam', description='The node name. When AnswerSource is set to BotFramework, a value is returned for this parameter.', example='{\\\\"skills\\\\":\\\\"chat_search\\\\",\\\\"accessToken\\\\":\\\\"73f4d5c8e8c334d9b538890bca68ac9a\\\\",\\\\"senderStaffId\\\\":\\\\"1697204021326\\\\",\\\\"senderCorpId\\\\":\\\\"dingee291fb2828058b9\\\\"}'),
}

model BeeBotChatShrinkRequest {
  chatBotInstanceId?: string(name='ChatBotInstanceId', description='Indicates whether the answer is in plain text or rich text.

This parameter is required.', example='1'),
  custSpaceId?: string(name='CustSpaceId', description='The metadata.', example='293483938849493'),
  intentName?: string(name='IntentName', description='The source of the answer.', example='intent'),
  isvCode?: string(name='IsvCode', description='The source of the answer.', example='ksiekdki39ksks93939'),
  knowledgeId?: string(name='KnowledgeId', description='The hit statement.', example='1'),
  perspectiveShrink?: string(name='Perspective', description='Beijing'),
  senderId?: string(name='SenderId', description='The information about the slot.', example='861500000000'),
  senderNick?: string(name='SenderNick', description='Beijing', example='nick'),
  sessionId?: string(name='SessionId', description='The title of the related knowledge.', example='en'),
  utterance?: string(name='Utterance', description='The title of the hit question.

This parameter is required.', example='659216218162179'),
  vendorParamShrink?: string(name='VendorParam', description='The node name. When AnswerSource is set to BotFramework, a value is returned for this parameter.', example='{\\\\"skills\\\\":\\\\"chat_search\\\\",\\\\"accessToken\\\\":\\\\"73f4d5c8e8c334d9b538890bca68ac9a\\\\",\\\\"senderStaffId\\\\":\\\\"1697204021326\\\\",\\\\"senderCorpId\\\\":\\\\"dingee291fb2828058b9\\\\"}'),
}

model BeeBotChatResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='Access denied for detailed information.', example='None'),
  code?: string(name='Code', description='The content of the text message.', example='OK'),
  data?: {
    messageId?: string(name='MessageId', description='The ID of the recommended knowledge.', example='ab6be8af-cee4-40c3-9919-2ac7461d7d98'),
    messages?: [ 
      {
        answerSource?: string(name='AnswerSource', description='When AnswerType is Recommended, this field indicates the source of the recommended answer.', example='KNOWLEDGE'),
        answerType?: string(name='AnswerType', description='The type of this message.', example='Text'),
        knowledge?: {
          answerSource?: string(name='AnswerSource', description='Distinguish answer types.', example='KnowledgeBase'),
          category?: string(name='Category', description='Knowledge category.', example='provident fund.'),
          content?: string(name='Content', description='Hit the content of the problem.', example='Provident fund withdrawal, please search for provident fund withdrawal on the homepage and submit the form for handling the matter.'),
          contentType?: string(name='ContentType', description='Indication of plain/rich text answers.', example='PLAIN_TEXT'),
          hitStatement?: string(name='HitStatement', description='Hit statement.', example='provident fund'),
          id?: string(name='Id', description='The ID of the hit problem in the knowledge base.', example='735898'),
          relatedKnowledges?: [ 
            {
              knowledgeId?: string(name='KnowledgeId', description='The ID of knowledge associated with knowledge.', example='735899'),
              title?: string(name='Title', description='The title of related knowledge.', example='Withdrawal of housing provident fund.'),
            }
          ](name='RelatedKnowledges', description='Related knowledge list.'),
          summary?: string(name='Summary', description='Introduction to hit problems.', example='Withdrawal of housing provident fund'),
          title?: string(name='Title', description='Hit the title of the problem.', example='Withdrawal of housing provident fund.'),
        }(name='Knowledge', description='When AnswerType is Knowledge, this field contains the Knowledge object returned by the robot.'),
        recommends?: [ 
          {
            answerSource?: string(name='AnswerSource', description='Clarify the identification of the source.', example='KNOWLEDGE'),
            knowledgeId?: string(name='KnowledgeId', description='Clarify the knowledge ID.', example='4548'),
            title?: string(name='Title', description='Clarify the content, which may be the entities of graph Q&A, the knowledge titles of knowledge Q&A, or the column values of table Q&A.', example='Test plain text.'),
          }
        ](name='Recommends', description='When AnswerType is Recommended, this field contains a list of Recommendations returned by the robot.'),
        text?: {
          answerSource?: string(name='AnswerSource', description='Distinguish answer types.', example='BotFramework'),
          content?: string(name='Content', description='The content of the text message.', example='May I ask where you want to check the weather?'),
          contentType?: string(name='ContentType', description='Indication of plain/rich text answers.', example='PLAIN_TEXT'),
          dialogName?: string(name='DialogName', description='When AnswerSource is BotFramework, this field returns the name of the dialogue unit.', example='Example: Checking Weather'),
          ext?: map[string]any(name='Ext', description='This field returns transparent parameters.'),
          externalFlags?: map[string]any(name='ExternalFlags', description='When AnswerSource is BotFramework, this field returns a transparent parameter.'),
          hitStatement?: string(name='HitStatement', description='Hit statement.', example='Check the weather.'),
          intentName?: string(name='IntentName', description='When AnswerSource is BotFramework, this field returns the intent name.', example='Check weather intention.'),
          metaData?: string(name='MetaData', description='Metadata.', example='[[{\\\\"columnName\\\\":\\\\"name\\\\",\\\\"stringValue\\\\":\\\\"wangshanshan\\\\"}]]'),
          nodeId?: string(name='NodeId', description='When AnswerSource is BotFramework, this field returns the node ID.', example='1410-c7a72a78.__city'),
          nodeName?: string(name='NodeName', description='When AnswerSource is BotFramework, this field returns the node name.', example='Example: Checking Weather Check the weather and fill in the slots__ city'),
          slots?: [ 
            {
              hit?: boolean(name='Hit', description='Whether it hits.', example='false'),
              name?: string(name='Name', description='Name.', example='Check weather intentions. city'),
              origin?: string(name='Origin', description='Original value.', example='Beijing'),
              value?: string(name='Value', description='Specific values.', example='Beijing'),
            }
          ](name='Slots', description='Slot information list.'),
          userDefinedChatTitle?: string(name='UserDefinedChatTitle', description='Custom Chat Topic Title.', example='greet.'),
        }(name='Text', description='When AnswerType is Text, this field contains the Text object returned by the robot.'),
      }
    ](name='Messages', description='The source of the recommended answer. When AnswerType is set to Recommend, a value is returned for this parameter.'),
    sessionId?: string(name='SessionId', description='The source of the recommended answer.', example='1234'),
  }(name='Data', description='The list of the recommended knowledge. When AnswerType is set to Recommend, the list of the recommended knowledge is returned by the bot for this parameter.'),
  message?: string(name='Message', description='Indicates whether the answer is in plain text or rich text.', example='none'),
  requestId?: string(name='RequestId', description='The passthrough parameter.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model BeeBotChatResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BeeBotChatResponseBody(name='body'),
}

/**
 * @summary Conducts sessions with the bot based on its unique identifier (ID).
 *
 * @description The ID of the session.
 *
 * @param tmpReq BeeBotChatRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BeeBotChatResponse
 */
async function beeBotChatWithOptions(tmpReq: BeeBotChatRequest, runtime: $RuntimeOptions): BeeBotChatResponse {
  tmpReq.validate();
  var request = new BeeBotChatShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.perspective)) {
    request.perspectiveShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.perspective, 'Perspective', 'json');
  }
  if (!$isNull(tmpReq.vendorParam)) {
    request.vendorParamShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.vendorParam, 'VendorParam', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.chatBotInstanceId)) {
    body['ChatBotInstanceId'] = request.chatBotInstanceId;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.intentName)) {
    body['IntentName'] = request.intentName;
  }
  if (!$isNull(request.isvCode)) {
    body['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.knowledgeId)) {
    body['KnowledgeId'] = request.knowledgeId;
  }
  if (!$isNull(request.perspectiveShrink)) {
    body['Perspective'] = request.perspectiveShrink;
  }
  if (!$isNull(request.senderId)) {
    body['SenderId'] = request.senderId;
  }
  if (!$isNull(request.senderNick)) {
    body['SenderNick'] = request.senderNick;
  }
  if (!$isNull(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!$isNull(request.utterance)) {
    body['Utterance'] = request.utterance;
  }
  if (!$isNull(request.vendorParamShrink)) {
    body['VendorParam'] = request.vendorParamShrink;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'BeeBotChat',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Conducts sessions with the bot based on its unique identifier (ID).
 *
 * @description The ID of the session.
 *
 * @param request BeeBotChatRequest
 * @return BeeBotChatResponse
 */
async function beeBotChat(request: BeeBotChatRequest): BeeBotChatResponse {
  var runtime = new $RuntimeOptions{};
  return beeBotChatWithOptions(request, runtime);
}

model ChatappBindWabaRequest {
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  wabaId?: string(name='WabaId', description='This parameter is required.', example='33993***'),
}

model ChatappBindWabaResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='C02029392939939'),
    wabaId?: string(name='WabaId', description='The ID of the WhatsApp Business Account (WABA).', example='2939828282'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message returned.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model ChatappBindWabaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappBindWabaResponseBody(name='body'),
}

/**
 * @summary Binds the WhatsApp Business account with ChatApp.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappBindWabaRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappBindWabaResponse
 */
async function chatappBindWabaWithOptions(request: ChatappBindWabaRequest, runtime: $RuntimeOptions): ChatappBindWabaResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.wabaId)) {
    query['WabaId'] = request.wabaId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappBindWaba',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Binds the WhatsApp Business account with ChatApp.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappBindWabaRequest
 * @return ChatappBindWabaResponse
 */
async function chatappBindWaba(request: ChatappBindWabaRequest): ChatappBindWabaResponse {
  var runtime = new $RuntimeOptions{};
  return chatappBindWabaWithOptions(request, runtime);
}

model ChatappEmbedSignUpRequest {
  inputToken?: string(name='InputToken', description='The InputToken returned after the embedded signup flow is complete.

This parameter is required.', example='wlelkelwidilwloe-ewlwols0lwsllsld'),
}

model ChatappEmbedSignUpResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  wabas?: [ 
    {
      accountReviewStatus?: string(name='AccountReviewStatus', description='The review state of the WABA.', example='VERIFIED'),
      currency?: string(name='Currency', description='The currency.', example='USD'),
      id?: string(name='Id', description='The ID of the WABA.', example='2939933992*****'),
      messageTemplateNamespace?: string(name='MessageTemplateNamespace', description='The namespace of the message template.', example='alals-lsslls-slslsos-slsl'),
      name?: string(name='Name', description='The name of the WABA.', example='Alibaba'),
    }
  ](name='Wabas', description='The list of the WhatsApp Business accounts.'),
}

model ChatappEmbedSignUpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappEmbedSignUpResponseBody(name='body'),
}

/**
 * @summary Queries WhatsApp Business account (WABA) information after embedded signup. You do not need to call this API operation if you use Version 2 of WhatsApp embedded signup.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappEmbedSignUpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappEmbedSignUpResponse
 */
async function chatappEmbedSignUpWithOptions(request: ChatappEmbedSignUpRequest, runtime: $RuntimeOptions): ChatappEmbedSignUpResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.inputToken)) {
    body['InputToken'] = request.inputToken;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappEmbedSignUp',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries WhatsApp Business account (WABA) information after embedded signup. You do not need to call this API operation if you use Version 2 of WhatsApp embedded signup.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappEmbedSignUpRequest
 * @return ChatappEmbedSignUpResponse
 */
async function chatappEmbedSignUp(request: ChatappEmbedSignUpRequest): ChatappEmbedSignUpResponse {
  var runtime = new $RuntimeOptions{};
  return chatappEmbedSignUpWithOptions(request, runtime);
}

model ChatappMigrationRegisterRequest {
  custSpaceId?: string(name='CustSpaceId', description='None

This parameter is required.', example='29348393884****'),
  phoneNumber?: string(name='PhoneNumber', description='phone number.

This parameter is required.', example='8613800****'),
}

model ChatappMigrationRegisterResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='SUCCESS'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model ChatappMigrationRegisterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappMigrationRegisterResponseBody(name='body'),
}

/**
 * @summary Registers a phone number for migration.
 *
 * @description The space ID of the RAM user within the independent software vendor (ISV) account.
 *
 * @param request ChatappMigrationRegisterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappMigrationRegisterResponse
 */
async function chatappMigrationRegisterWithOptions(request: ChatappMigrationRegisterRequest, runtime: $RuntimeOptions): ChatappMigrationRegisterResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappMigrationRegister',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Registers a phone number for migration.
 *
 * @description The space ID of the RAM user within the independent software vendor (ISV) account.
 *
 * @param request ChatappMigrationRegisterRequest
 * @return ChatappMigrationRegisterResponse
 */
async function chatappMigrationRegister(request: ChatappMigrationRegisterRequest): ChatappMigrationRegisterResponse {
  var runtime = new $RuntimeOptions{};
  return chatappMigrationRegisterWithOptions(request, runtime);
}

model ChatappMigrationVerifiedRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='861380001234'),
  verifyCode?: string(name='VerifyCode', description='The verification code.

This parameter is required.', example='828798'),
}

model ChatappMigrationVerifiedResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    id?: string(name='Id', description='The ID of the phone number.', example='82828893332'),
    phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='8613800001234'),
  }(name='Data', description='The data returned.'),
  message?: string(name='Message', description='The error message returned.', example='SUCCESS'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model ChatappMigrationVerifiedResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappMigrationVerifiedResponseBody(name='body'),
}

/**
 * @summary Verifies a specified phone number for migration.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappMigrationVerifiedRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappMigrationVerifiedResponse
 */
async function chatappMigrationVerifiedWithOptions(request: ChatappMigrationVerifiedRequest, runtime: $RuntimeOptions): ChatappMigrationVerifiedResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.verifyCode)) {
    query['VerifyCode'] = request.verifyCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappMigrationVerified',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Verifies a specified phone number for migration.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappMigrationVerifiedRequest
 * @return ChatappMigrationVerifiedResponse
 */
async function chatappMigrationVerified(request: ChatappMigrationVerifiedRequest): ChatappMigrationVerifiedResponse {
  var runtime = new $RuntimeOptions{};
  return chatappMigrationVerifiedWithOptions(request, runtime);
}

model ChatappPhoneNumberDeregisterRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.

This parameter is required.', example='939283893939'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number that you want to deregister.

This parameter is required.', example='8613800000000'),
}

model ChatappPhoneNumberDeregisterResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   Other values indicate that the request failed. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model ChatappPhoneNumberDeregisterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappPhoneNumberDeregisterResponseBody(name='body'),
}

/**
 * @summary Deregisters a phone number from a WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappPhoneNumberDeregisterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappPhoneNumberDeregisterResponse
 */
async function chatappPhoneNumberDeregisterWithOptions(request: ChatappPhoneNumberDeregisterRequest, runtime: $RuntimeOptions): ChatappPhoneNumberDeregisterResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappPhoneNumberDeregister',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deregisters a phone number from a WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappPhoneNumberDeregisterRequest
 * @return ChatappPhoneNumberDeregisterResponse
 */
async function chatappPhoneNumberDeregister(request: ChatappPhoneNumberDeregisterRequest): ChatappPhoneNumberDeregisterResponse {
  var runtime = new $RuntimeOptions{};
  return chatappPhoneNumberDeregisterWithOptions(request, runtime);
}

model ChatappPhoneNumberRegisterRequest {
  custSpaceId?: string(name='CustSpaceId', description='This parameter is required.', example='939283893939'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='This parameter is required.', example='8613800000000'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ChatappPhoneNumberRegisterResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='None.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model ChatappPhoneNumberRegisterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappPhoneNumberRegisterResponseBody(name='body'),
}

/**
 * @summary Registers a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappPhoneNumberRegisterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappPhoneNumberRegisterResponse
 */
async function chatappPhoneNumberRegisterWithOptions(request: ChatappPhoneNumberRegisterRequest, runtime: $RuntimeOptions): ChatappPhoneNumberRegisterResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappPhoneNumberRegister',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Registers a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappPhoneNumberRegisterRequest
 * @return ChatappPhoneNumberRegisterResponse
 */
async function chatappPhoneNumberRegister(request: ChatappPhoneNumberRegisterRequest): ChatappPhoneNumberRegisterResponse {
  var runtime = new $RuntimeOptions{};
  return chatappPhoneNumberRegisterWithOptions(request, runtime);
}

model ChatappSyncPhoneNumberRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ChatappSyncPhoneNumberResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='None.'),
  phoneNumbers?: [ 
    {
      codeVerificationStatus?: string(name='CodeVerificationStatus', description='The verification status.', example='VERIFIED'),
      isOfficial?: string(name='IsOfficial', example='N'),
      messagingLimitTier?: string(name='MessagingLimitTier', description='The number of phone numbers to which messages can be sent in a day.', example='TIER_10'),
      nameStatus?: string(name='NameStatus', description='The review status of the business display name.', example='Approval'),
      newNameStatus?: string(name='NewNameStatus', description='The review status of the new business display name.', example='Approval'),
      phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='8613800001234'),
      qualityRating?: string(name='QualityRating', description='The quality rating of the phone number. Valid values: GREEN, YELLOW, and RED.', example='GREEN'),
      status?: string(name='Status', description='The status of the phone number.', example='PENDING'),
      statusCallbackUrl?: string(name='StatusCallbackUrl', description='The callback URL to which status reports are sent by using HTTP callbacks.', example='https://www.alibaba.com/status'),
      statusQueue?: string(name='StatusQueue', description='The status report queue.', example='alicom-09399200-queue'),
      upCallbackUrl?: string(name='UpCallbackUrl', description='The callback URL to which MO messages are sent by using HTTP callbacks.', example='https://www.alibaba.com/inbound'),
      upQueue?: string(name='UpQueue', description='The mobile originated (MO) message queue.', example='alicom-09399200-queue'),
      verifiedName?: string(name='VerifiedName', description='The display name of the business to which the phone number belongs.', example='Alibaba'),
    }
  ](name='PhoneNumbers', description='Details of the phone numbers.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', example='true'),
}

model ChatappSyncPhoneNumberResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappSyncPhoneNumberResponseBody(name='body'),
}

/**
 * @summary Synchronizes phone numbers.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappSyncPhoneNumberRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappSyncPhoneNumberResponse
 */
async function chatappSyncPhoneNumberWithOptions(request: ChatappSyncPhoneNumberRequest, runtime: $RuntimeOptions): ChatappSyncPhoneNumberResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappSyncPhoneNumber',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Synchronizes phone numbers.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappSyncPhoneNumberRequest
 * @return ChatappSyncPhoneNumberResponse
 */
async function chatappSyncPhoneNumber(request: ChatappSyncPhoneNumberRequest): ChatappSyncPhoneNumberResponse {
  var runtime = new $RuntimeOptions{};
  return chatappSyncPhoneNumberWithOptions(request, runtime);
}

model ChatappVerifyAndRegisterRequest {
  custSpaceId?: string(name='CustSpaceId', description='This parameter is required.', example='29389299388383'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='This parameter is required.', example='86138000000'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  verifyCode?: string(name='VerifyCode', description='This parameter is required.', example='123466'),
}

model ChatappVerifyAndRegisterResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', example='true'),
}

model ChatappVerifyAndRegisterResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChatappVerifyAndRegisterResponseBody(name='body'),
}

/**
 * @summary Associates a phone number with a WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappVerifyAndRegisterRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChatappVerifyAndRegisterResponse
 */
async function chatappVerifyAndRegisterWithOptions(request: ChatappVerifyAndRegisterRequest, runtime: $RuntimeOptions): ChatappVerifyAndRegisterResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.verifyCode)) {
    query['VerifyCode'] = request.verifyCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChatappVerifyAndRegister',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Associates a phone number with a WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ChatappVerifyAndRegisterRequest
 * @return ChatappVerifyAndRegisterResponse
 */
async function chatappVerifyAndRegister(request: ChatappVerifyAndRegisterRequest): ChatappVerifyAndRegisterResponse {
  var runtime = new $RuntimeOptions{};
  return chatappVerifyAndRegisterWithOptions(request, runtime);
}

model CreateChatappMigrationInitiateRequest {
  countryCode?: string(name='CountryCode', description='The code of the country or region.

This parameter is required.', example='86'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.

This parameter is required.', example='293483938849493****'),
  mobileNumber?: string(name='MobileNumber', description='The mobile number without the country code or region code.

This parameter is required.', example='13900001234'),
}

model CreateChatappMigrationInitiateResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The information about the request denial..', example='None'),
  code?: string(name='Code', description='The response code.

*   A value of OK indicates that the request was successful.
*   For more information about other response codes, see [API error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    id?: string(name='Id', description='The ID of the mobile number.', example='82828893332'),
    phoneNumber?: string(name='PhoneNumber', description='The mobile number.', example='8613900001234'),
    status?: string(name='Status', description='The state of the mobile number. Only MIGRATING may be returned, which indicates that the mobile number is being migrated.', example='MIGRATING'),
  }(name='Data', description='The response data.'),
  message?: string(name='Message', description='The error message returned.', example='SUCCESS'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model CreateChatappMigrationInitiateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateChatappMigrationInitiateResponseBody(name='body'),
}

/**
 * @summary The ID of the number.
 *
 * @description The status of the phone number.
 *
 * @param request CreateChatappMigrationInitiateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateChatappMigrationInitiateResponse
 */
async function createChatappMigrationInitiateWithOptions(request: CreateChatappMigrationInitiateRequest, runtime: $RuntimeOptions): CreateChatappMigrationInitiateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.countryCode)) {
    query['CountryCode'] = request.countryCode;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.mobileNumber)) {
    query['MobileNumber'] = request.mobileNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateChatappMigrationInitiate',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the number.
 *
 * @description The status of the phone number.
 *
 * @param request CreateChatappMigrationInitiateRequest
 * @return CreateChatappMigrationInitiateResponse
 */
async function createChatappMigrationInitiate(request: CreateChatappMigrationInitiateRequest): CreateChatappMigrationInitiateResponse {
  var runtime = new $RuntimeOptions{};
  return createChatappMigrationInitiateWithOptions(request, runtime);
}

model CreateChatappTemplateRequest {
  allowCategoryChange?: boolean(name='AllowCategoryChange', description='Specifies whether to allow Facebook to automatically change the directory of the template. If you set this parameter to true, the review success rate of the template is improved. This parameter is valid only when TemplateType is set to WHATSAPP.', example='true'),
  category?: string(name='Category', description='The category of the template if TemplateType is set to WHATSAPP. Valid values:

*   **UTILITY**: the transaction template
*   **MARKETING**: the marketing template
*   **AUTHENTICATION**: the authentication template

The category of the template if TemplateType is set to VIBER. Valid values:

*   **text**: the template that contains only text
*   **image**: the template that contains only images
*   **text_image_button**: the template that contains text, images, and buttons
*   **text_button**: the template that contains text and buttons
*   **document**: the template that contains only documents
*   **video**: the template that contains only videos
*   **text_video**: the template that contains text and videos
*   **text_video_button**: the template that contains text, videos, and buttons
*   **text_image**: the template that contains text and images

This parameter is required.', example='The code of the message template.'),
  components?: [ 
    {
      addSecretRecommendation?: boolean(name='AddSecretRecommendation', description='The note indicating that customers cannot share verification codes with others. The note is displayed in the message body. This parameter is valid if Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to BODY for a WhatsApp message template.', example='true'),
      buttons?: [ 
        {
          autofillText?: string(name='AutofillText', description='The text of the one-tap autofill button. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.', example='Autofill'),
          couponCode?: string(name='CouponCode', description='The coupon code. It can contain only letters and digits. You can set this parameter to a variable such as $(couponCode). Specify the value of couponCode when you send a message.', example='120293'),
          flowAction?: string(name='FlowAction', description='The Flow action.

Valid values:

*   DATA_EXCHANGE
*   NAVIGATE', example='NAVIGATE'),
          flowId?: string(name='FlowId', description='The Flow ID.', example='479884093605183'),
          isOptOut?: boolean(name='IsOptOut', description='The unsubscribe button. This parameter is valid if Category is set to MARKETING and the Type sub-parameter of the Buttons parameter is set to QUICK_REPLY for a WhatsApp message template. Marketing messages will not be sent to customers if you configure message sending in the Chat App Message Service console and the customers click this button.', example='false'),
          navigateScreen?: string(name='NavigateScreen', description='The first screen in the Flow. This parameter is required if FlowAction is set to NAVIGATE.', example='DETAILS'),
          packageName?: string(name='PackageName', description='The app package name that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.', example='com.demo', deprecated=true),
          phoneNumber?: string(name='PhoneNumber', description='The phone number. This parameter is valid only when the Type sub-parameter of the Buttons parameter is set to **PHONE_NUMBER**.', example='+861368897****'),
          signatureHash?: string(name='SignatureHash', description='The app signing key hash that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.', example='wi299382', deprecated=true),
          supportedApps?: [ 
            {
              packageName?: string(name='PackageName', description='The name of the Android application package. This parameter is required if you create an Android application.', example='com.kuaidian.waimaistaff'),
              signatureHash?: string(name='SignatureHash', description='WhatsApp template is required when Category is Authoritative and Button Type is ONE_TAP/ZERO-TAP, indicating the signature hash value of the WhatsApp application.', example='ieid83kdiek'),
            }
          ](name='SupportedApps', description='List of supported apps.'),
          text?: string(name='Text', description='The display name of the button.', example='Call Me'),
          type?: string(name='Type', description='The type of the button. Valid values:

*   **PHONE_NUMBER**: phone call button
*   **URL**: URL button
*   **QUICK_REPLY**: quick reply button
*   **COPY_CODE**: copy code button
*   **ONE_TAP**: one-tap autofill button if Category is set to AUTHENTICATION

> 

*   If Category is set to AUTHENTICATION for a WhatsApp message template, you can add only one button to the WhatsApp message template and you must set the Type sub-parameter of the Buttons parameter to COPY_CODE or ONE_TAP. If Type is set to COPY_CODE, the Text sub-parameter of the Buttons parameter is required. If Type is set to ONE_TAP, the Text, SignatureHash, PackageName, and AutofillText sub-parameters of the Buttons parameter are required. The value of Text is displayed if the desired app is not installed on the device. The value of Text indicates that you must manually copy the verification code.

*   You can add only one button to a Viber message template, and you must set the Type sub-parameter of the Buttons parameter to URL.

This parameter is required.', example='PHONE_NUMBER'),
          url?: string(name='Url', description='The URL to be accessed when you click the URL button.', example='https://example.com'),
          urlType?: string(name='UrlType', description='The type of the URL. Valid values:

*   **static**
*   **dynamic**', example='static'),
        }
      ](name='Buttons', description='The buttons. Specify this parameter only if you set the Type sub-parameter of the Components parameter to **BUTTONS**.

>  ####

*   A marketing or utility WhatsApp message template can contain up to 10 buttons.

*   A WhatsApp message template can contain only one phone call button.

*   A WhatsApp message template can contain up to two URL buttons.

*   In a WhatsApp message template, a quick reply button cannot be used together with a phone call button or a URL button.'),
      caption?: string(name='Caption', description='The description of the document.', example='This is a video'),
      cards?: [ 
        {
          cardComponents?: [ 
            {
              buttons?: [ 
                {
                  phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='+8613800'),
                  text?: string(name='Text', description='The text of the button.', example='Call me'),
                  type?: string(name='Type', description='The type of the button. Valid values:

*   **PHONE_NUMBER**: phone call button
*   **URL**: URL button
*   **QUICK_REPLY**: quick reply button

This parameter is required.', example='PHONE_NUMBER'),
                  url?: string(name='Url', description='The URL to which you are redirected when you click the URL button.', example='https://alibaba.com/xx'),
                  urlType?: string(name='UrlType', description='The type of the URL. Valid values:

*   **static**
*   **dynamic**', example='static'),
                }
              ](name='Buttons', description='The buttons. Specify this parameter only if you set the Type sub-parameter of the CardComponents parameter to BUTTONS. A carousel card can contain up to two buttons.'),
              format?: string(name='Format', description='The type of the media resource. This parameter is valid if the Type sub-parameter of the CardComponents parameter is set to HEADER. Valid values:

*   **IMAGE**
*   **VIDEO**', example='IMAGE'),
              text?: string(name='Text', description='The body content of the carousel card.', example='Who is the very powerful team'),
              type?: string(name='Type', description='The type of the component. Valid values:

*   **BODY**
*   **HEADER**
*   **BUTTONS**

This parameter is required.', example='BODY'),
              url?: string(name='Url', description='The URL of the media resource.', example='https://alibaba.com/img.png'),
            }
          ](name='CardComponents', description='The components of the carousel card.

This parameter is required.'),
        }
      ](name='Cards', description='The carousel cards of the carousel template.'),
      codeExpirationMinutes?: int32(name='CodeExpirationMinutes', description='The validity period of the verification code in the WhatsApp authentication template. Unit: minutes. This parameter is valid only when Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to FOOTER. The validity period of the verification code is displayed in the footer.', example='5'),
      duration?: int32(name='Duration', description='The length of the video in the Viber message template. Unit: seconds. Valid values: 0 to 600.', example='120'),
      fileName?: string(name='FileName', description='The name of the document.', example='video name'),
      fileType?: string(name='FileType', description='The type of the document attached in the Viber message template.', example='docx'),
      format?: string(name='Format', description='The type of the media resource. Valid values:

*   **TEXT**
*   **IMAGE**
*   **DOCUMENT**
*   **VIDEO**', example='TEXT'),
      hasExpiration?: boolean(name='HasExpiration', description='Specifies whether the coupon code has an expiration time. Specify this parameter if the Type sub-parameter of the Components parameter is set to LIMITED_TIME_OFFER.', example='true'),
      text?: string(name='Text', description='The text of the message that you want to send.

>  If Category is set to AUTHENTICATION, the Text sub-parameter of the Components parameter must be empty.', example='hello whatsapp'),
      thumbUrl?: string(name='ThumbUrl', description='The thumbnail URL of the video in the Viber message template.', example='https://cdn.multiplymall.mobiapp.cloud/yunmall/B-LM-LMALL202207130001/20220730/d712a057-a6af-4513-bbe6-7ee57ea60983.png?x-oss-process=image/resize,w_100'),
      type?: string(name='Type', description='The type of the component. Valid values:

*   **BODY**
*   **HEADER**
*   **FOOTER**
*   **BUTTONS**
*   **CAROUSEL**
*   **LIMITED_TIME_OFFER**

> 

*   In a WhatsApp message template, a **Body** component cannot exceed 1,024 characters in length. A **HEADER** or **FOOTER** component cannot exceed 60 characters in length.

*   **FOOTER**, **CAROUSEL**, and **LIMITED_TIME_OFFER** components are not supported in Viber message templates.

*   In Viber message templates, media resources such as images, videos, and documents are placed in the **HEADER** component. If a Viber message contains text and an image, the image is placed below the text in the message received on a device.

This parameter is required.', example='BODY'),
      url?: string(name='Url', description='The URL of the media resource.

>  We recommend that you use 800 × 800 images in Viber message templates.', example='https://image.developer.aliyundoc.com'),
    }
  ](name='Components', description='The components of the message template.

>  If Category is set to AUTHENTICATION, the Type sub-parameter of the Components parameter cannot be set to HEADER. If the Type sub-parameter is set to BODY or FOOTER, the Text sub-parameter of the Components parameter must be empty.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.', example='293483938849493'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

> CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  example?: map[string]string(name='Example', description='The examples of variables that are used when you create the message template.'),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code, which is used to verify whether the user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).

This parameter is required.', example='en'),
  messageSendTtlSeconds?: int32(name='MessageSendTtlSeconds', description='Validity period of authentication template message sending in WhatsApp

> This attribute requires providing waba in advance to Alibaba operators to open the whitelist, otherwise it will result in template submission failure', example='120'),
  name?: string(name='Name', description='The name of the message template.

This parameter is required.', example='hello_whatsapp'),
  templateType?: string(name='TemplateType', description='The type of the message template.

*   **WHATSAPP**
*   **VIBER**
*   LINE: the Line message template. This type of message template will be released later.

This parameter is required.', example='WHATSAPP'),
}

model CreateChatappTemplateShrinkRequest {
  allowCategoryChange?: boolean(name='AllowCategoryChange', description='Specifies whether to allow Facebook to automatically change the directory of the template. If you set this parameter to true, the review success rate of the template is improved. This parameter is valid only when TemplateType is set to WHATSAPP.', example='true'),
  category?: string(name='Category', description='The category of the template if TemplateType is set to WHATSAPP. Valid values:

*   **UTILITY**: the transaction template
*   **MARKETING**: the marketing template
*   **AUTHENTICATION**: the authentication template

The category of the template if TemplateType is set to VIBER. Valid values:

*   **text**: the template that contains only text
*   **image**: the template that contains only images
*   **text_image_button**: the template that contains text, images, and buttons
*   **text_button**: the template that contains text and buttons
*   **document**: the template that contains only documents
*   **video**: the template that contains only videos
*   **text_video**: the template that contains text and videos
*   **text_video_button**: the template that contains text, videos, and buttons
*   **text_image**: the template that contains text and images

This parameter is required.', example='The code of the message template.'),
  componentsShrink?: string(name='Components', description='The components of the message template.

>  If Category is set to AUTHENTICATION, the Type sub-parameter of the Components parameter cannot be set to HEADER. If the Type sub-parameter is set to BODY or FOOTER, the Text sub-parameter of the Components parameter must be empty.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.', example='293483938849493'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

> CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  exampleShrink?: string(name='Example', description='The examples of variables that are used when you create the message template.'),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code, which is used to verify whether the user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).

This parameter is required.', example='en'),
  messageSendTtlSeconds?: int32(name='MessageSendTtlSeconds', description='Validity period of authentication template message sending in WhatsApp

> This attribute requires providing waba in advance to Alibaba operators to open the whitelist, otherwise it will result in template submission failure', example='120'),
  name?: string(name='Name', description='The name of the message template.

This parameter is required.', example='hello_whatsapp'),
  templateType?: string(name='TemplateType', description='The type of the message template.

*   **WHATSAPP**
*   **VIBER**
*   LINE: the Line message template. This type of message template will be released later.

This parameter is required.', example='WHATSAPP'),
}

model CreateChatappTemplateResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    templateCode?: string(name='TemplateCode', description='The code of the message template.', example='SMS_232907****'),
    templateName?: string(name='TemplateName', description='The name of the message template.', example='hello_whatsapp'),
  }(name='Data', description='The data returned.', example='{"templateCode": "****4b5c79c9432497a075bdfca36bf5"，"templateName": "hello_whatsapp"}'),
  message?: string(name='Message', description='The error message returned.', example='User not authorized to operate on the specified resource.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2D'),
}

model CreateChatappTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateChatappTemplateResponseBody(name='body'),
}

/**
 * @summary The HTTP status code.
 * \\\\\\\\*   Example: OK. This parameter indicates that the request is successful.
 * \\\\\\\\*   Other values indicate that the request fails. For more information, see \\\\\\[Error codes]\\\\\\(https://www.alibabacloud.com/help/zh/cams/latest/api-error-codes).
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to 50 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq CreateChatappTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateChatappTemplateResponse
 */
async function createChatappTemplateWithOptions(tmpReq: CreateChatappTemplateRequest, runtime: $RuntimeOptions): CreateChatappTemplateResponse {
  tmpReq.validate();
  var request = new CreateChatappTemplateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.components)) {
    request.componentsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.components, 'Components', 'json');
  }
  if (!$isNull(tmpReq.example)) {
    request.exampleShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.example, 'Example', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.allowCategoryChange)) {
    body['AllowCategoryChange'] = request.allowCategoryChange;
  }
  if (!$isNull(request.category)) {
    body['Category'] = request.category;
  }
  if (!$isNull(request.componentsShrink)) {
    body['Components'] = request.componentsShrink;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.custWabaId)) {
    body['CustWabaId'] = request.custWabaId;
  }
  if (!$isNull(request.exampleShrink)) {
    body['Example'] = request.exampleShrink;
  }
  if (!$isNull(request.isvCode)) {
    body['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.language)) {
    body['Language'] = request.language;
  }
  if (!$isNull(request.messageSendTtlSeconds)) {
    body['MessageSendTtlSeconds'] = request.messageSendTtlSeconds;
  }
  if (!$isNull(request.name)) {
    body['Name'] = request.name;
  }
  if (!$isNull(request.templateType)) {
    body['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateChatappTemplate',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The HTTP status code.
 * \\\\\\\\*   Example: OK. This parameter indicates that the request is successful.
 * \\\\\\\\*   Other values indicate that the request fails. For more information, see \\\\\\[Error codes]\\\\\\(https://www.alibabacloud.com/help/zh/cams/latest/api-error-codes).
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to 50 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request CreateChatappTemplateRequest
 * @return CreateChatappTemplateResponse
 */
async function createChatappTemplate(request: CreateChatappTemplateRequest): CreateChatappTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return createChatappTemplateWithOptions(request, runtime);
}

model CreateFlowRequest {
  categories?: [ string ](name='Categories', description='The categories of the Flow.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='93994848'),
  flowName?: string(name='FlowName', description='The name of the Flow.

This parameter is required.', example='flow_001'),
}

model CreateFlowShrinkRequest {
  categoriesShrink?: string(name='Categories', description='The categories of the Flow.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='93994848'),
  flowName?: string(name='FlowName', description='The name of the Flow.

This parameter is required.', example='flow_001'),
}

model CreateFlowResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: {
    categories?: [ string ](name='Categories', description='The categories of the Flow.'),
    flowId?: string(name='FlowId', description='The Flow ID.', example='333993838***'),
    flowName?: string(name='FlowName', description='The name of the Flow.', example='test1'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model CreateFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFlowResponseBody(name='body'),
}

/**
 * @summary Creates a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq CreateFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFlowResponse
 */
async function createFlowWithOptions(tmpReq: CreateFlowRequest, runtime: $RuntimeOptions): CreateFlowResponse {
  tmpReq.validate();
  var request = new CreateFlowShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.categories)) {
    request.categoriesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.categories, 'Categories', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.categoriesShrink)) {
    body['Categories'] = request.categoriesShrink;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowName)) {
    body['FlowName'] = request.flowName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request CreateFlowRequest
 * @return CreateFlowResponse
 */
async function createFlow(request: CreateFlowRequest): CreateFlowResponse {
  var runtime = new $RuntimeOptions{};
  return createFlowWithOptions(request, runtime);
}

model CreatePhoneMessageQrdlRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='838833'),
  generateQrImage?: string(name='GenerateQrImage', description='Produce QR code image format.

This parameter is required.', example='PNG'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number. Add the country code before the phone number.

This parameter is required.', example='861380000'),
  prefilledMessage?: string(name='PrefilledMessage', description='Message content.

This parameter is required.', example='Hello'),
}

model CreatePhoneMessageQrdlResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: {
    deepLinkUrl?: string(name='DeepLinkUrl', description='The URL of the deep link.', example='https://wa.qrdl/'),
    generateQrImage?: string(name='GenerateQrImage', description='The format of the generated image.', example='PNG'),
    phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='8613800'),
    prefilledMessage?: string(name='PrefilledMessage', description='The message content.', example='Hello'),
    qrImageUrl?: string(name='QrImageUrl', description='The URL of the QR code.', example='http://img.png'),
    qrdlCode?: string(name='QrdlCode', description='The mode of the quick-response (QR) code.', example='D9II3***'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='none'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model CreatePhoneMessageQrdlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePhoneMessageQrdlResponseBody(name='body'),
}

/**
 * @summary Creates a quick-response (QR) code that contains a message.
 *
 * @param request CreatePhoneMessageQrdlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePhoneMessageQrdlResponse
 */
async function createPhoneMessageQrdlWithOptions(request: CreatePhoneMessageQrdlRequest, runtime: $RuntimeOptions): CreatePhoneMessageQrdlResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.generateQrImage)) {
    body['GenerateQrImage'] = request.generateQrImage;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.prefilledMessage)) {
    body['PrefilledMessage'] = request.prefilledMessage;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreatePhoneMessageQrdl',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a quick-response (QR) code that contains a message.
 *
 * @param request CreatePhoneMessageQrdlRequest
 * @return CreatePhoneMessageQrdlResponse
 */
async function createPhoneMessageQrdl(request: CreatePhoneMessageQrdlRequest): CreatePhoneMessageQrdlResponse {
  var runtime = new $RuntimeOptions{};
  return createPhoneMessageQrdlWithOptions(request, runtime);
}

model DeleteChatappTemplateRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the ISV account.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business Account (WABA) ID of the RAM user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****'),
  isvCode?: string(name='IsvCode', description='The ISV verification code. This parameter is used to verify whether the RAM user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  language?: string(name='Language', description='The template language.', example='zh_CN'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  templateCode?: string(name='TemplateCode', description='The template code.', example='744c4b5c79c9432497a075bdfca3****'),
  templateName?: string(name='TemplateName', description='The template name.', example='test_name'),
  templateType?: string(name='TemplateType', description='The template type. This parameter is required if you delete a template in a language.', example='WHATSAPP'),
}

model DeleteChatappTemplateResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   For more information about other response codes, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='User not authorized to operate on the specified resource.'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model DeleteChatappTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteChatappTemplateResponseBody(name='body'),
}

/**
 * @summary Deletes a message template.
 *
 * @description ### QPS limit
 * You can call this operation up to five times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteChatappTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteChatappTemplateResponse
 */
async function deleteChatappTemplateWithOptions(request: DeleteChatappTemplateRequest, runtime: $RuntimeOptions): DeleteChatappTemplateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.custWabaId)) {
    query['CustWabaId'] = request.custWabaId;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.templateCode)) {
    query['TemplateCode'] = request.templateCode;
  }
  if (!$isNull(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  if (!$isNull(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteChatappTemplate',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a message template.
 *
 * @description ### QPS limit
 * You can call this operation up to five times per second per account. If the number of the calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteChatappTemplateRequest
 * @return DeleteChatappTemplateResponse
 */
async function deleteChatappTemplate(request: DeleteChatappTemplateRequest): DeleteChatappTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return deleteChatappTemplateWithOptions(request, runtime);
}

model DeleteFlowRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='393983883'),
  flowId?: string(name='FlowId', description='The Flow ID.

This parameter is required.', example='flow_001'),
}

model DeleteFlowResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model DeleteFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFlowResponseBody(name='body'),
}

/**
 * @summary Deletes a Flow. Only Flows in the DRAFT state can be deleted.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFlowResponse
 */
async function deleteFlowWithOptions(request: DeleteFlowRequest, runtime: $RuntimeOptions): DeleteFlowResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a Flow. Only Flows in the DRAFT state can be deleted.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request DeleteFlowRequest
 * @return DeleteFlowResponse
 */
async function deleteFlow(request: DeleteFlowRequest): DeleteFlowResponse {
  var runtime = new $RuntimeOptions{};
  return deleteFlowWithOptions(request, runtime);
}

model DeletePhoneMessageQrdlRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='883873773'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number. Add the country code before the phone number.

This parameter is required.', example='861380000'),
  qrdlCode?: string(name='QrdlCode', description='QR code encoding.

This parameter is required.', example='29338838'),
}

model DeletePhoneMessageQrdlResponseBody = {
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   Other values indicate that the request failed. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model DeletePhoneMessageQrdlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeletePhoneMessageQrdlResponseBody(name='body'),
}

/**
 * @summary Deletes a quick-response (QR) code that contains a message.
 *
 * @param request DeletePhoneMessageQrdlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeletePhoneMessageQrdlResponse
 */
async function deletePhoneMessageQrdlWithOptions(request: DeletePhoneMessageQrdlRequest, runtime: $RuntimeOptions): DeletePhoneMessageQrdlResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.qrdlCode)) {
    body['QrdlCode'] = request.qrdlCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeletePhoneMessageQrdl',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a quick-response (QR) code that contains a message.
 *
 * @param request DeletePhoneMessageQrdlRequest
 * @return DeletePhoneMessageQrdlResponse
 */
async function deletePhoneMessageQrdl(request: DeletePhoneMessageQrdlRequest): DeletePhoneMessageQrdlResponse {
  var runtime = new $RuntimeOptions{};
  return deletePhoneMessageQrdlWithOptions(request, runtime);
}

model DeprecateFlowRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='38877483'),
  flowId?: string(name='FlowId', description='The Flow ID.

This parameter is required.', example='flow_001'),
}

model DeprecateFlowResponseBody = {
  code?: string(name='Code', description='The result returns OK as normal.', example='OK'),
  message?: string(name='Message', description='Error description information.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model DeprecateFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeprecateFlowResponseBody(name='body'),
}

/**
 * @summary Deprecates a Flow.
 *
 * @param request DeprecateFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeprecateFlowResponse
 */
async function deprecateFlowWithOptions(request: DeprecateFlowRequest, runtime: $RuntimeOptions): DeprecateFlowResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeprecateFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deprecates a Flow.
 *
 * @param request DeprecateFlowRequest
 * @return DeprecateFlowResponse
 */
async function deprecateFlow(request: DeprecateFlowRequest): DeprecateFlowResponse {
  var runtime = new $RuntimeOptions{};
  return deprecateFlowWithOptions(request, runtime);
}

model EnableWhatsappROIMetricRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.', example='293483938849493'),
  isvCode?: string(name='IsvCode', description='The verification code used to verify whether the RAM user is authorized by the independent software vendor (ISV) account.', example='skdi3kksloslikdkkdk'),
}

model EnableWhatsappROIMetricResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='NONE'),
  code?: string(name='Code', description='The value OK indicates that the request was successful.', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model EnableWhatsappROIMetricResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableWhatsappROIMetricResponseBody(name='body'),
}

/**
 * @summary Enables the statistics on the metrics that are related to WhatsApp.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request EnableWhatsappROIMetricRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableWhatsappROIMetricResponse
 */
async function enableWhatsappROIMetricWithOptions(request: EnableWhatsappROIMetricRequest, runtime: $RuntimeOptions): EnableWhatsappROIMetricResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'EnableWhatsappROIMetric',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables the statistics on the metrics that are related to WhatsApp.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request EnableWhatsappROIMetricRequest
 * @return EnableWhatsappROIMetricResponse
 */
async function enableWhatsappROIMetric(request: EnableWhatsappROIMetricRequest): EnableWhatsappROIMetricResponse {
  var runtime = new $RuntimeOptions{};
  return enableWhatsappROIMetricWithOptions(request, runtime);
}

model GetChatappPhoneNumberMetricRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the ISV account.', example='293483938849493'),
  end?: long(name='End', description='The end of the time range to query.

This parameter is required.', example='1693407714687'),
  granularity?: string(name='Granularity', description='The granularity of the metric.

Valid values:

*   DAILY
*   HALF_HOUR', example='DAILY'),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code, which is used to verify whether the RAM user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  phoneNumber?: string(name='PhoneNumber', description='The business phone number.', example='861380000'),
  start?: long(name='Start', description='The beginning of the time range to query.

This parameter is required.', example='1693107714687'),
}

model GetChatappPhoneNumberMetricResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='NONE'),
  code?: string(name='Code', description='The value OK indicates that the request was successful.', example='OK'),
  data?: [ 
    {
      deliveredCount?: int32(name='DeliveredCount', description='The number of delivered messages.', example='5'),
      end?: long(name='End', description='The end of the time range that you queried.', example='1667196043904'),
      granularity?: string(name='Granularity', description='The granularity of the metric.

Valid values:

*   DAILY
*   HALF_HOUR', example='DAILY'),
      phoneNumber?: string(name='PhoneNumber', description='The business phone number.', example='861380000'),
      sentCount?: int32(name='SentCount', description='The number of sent messages.', example='10'),
      start?: long(name='Start', description='The beginning of the time range that you queried.', example='1669619491000'),
    }
  ](name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='1612C226-E271-4CFE-9F18-4066D******'),
}

model GetChatappPhoneNumberMetricResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetChatappPhoneNumberMetricResponseBody(name='body'),
}

/**
 * @summary Queries the number of messages that are sent by using a phone number by a specific metric.
 *
 * @description You can call this operation up to 50 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappPhoneNumberMetricRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetChatappPhoneNumberMetricResponse
 */
async function getChatappPhoneNumberMetricWithOptions(request: GetChatappPhoneNumberMetricRequest, runtime: $RuntimeOptions): GetChatappPhoneNumberMetricResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.end)) {
    query['End'] = request.end;
  }
  if (!$isNull(request.granularity)) {
    query['Granularity'] = request.granularity;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.start)) {
    query['Start'] = request.start;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetChatappPhoneNumberMetric',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the number of messages that are sent by using a phone number by a specific metric.
 *
 * @description You can call this operation up to 50 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappPhoneNumberMetricRequest
 * @return GetChatappPhoneNumberMetricResponse
 */
async function getChatappPhoneNumberMetric(request: GetChatappPhoneNumberMetricRequest): GetChatappPhoneNumberMetricResponse {
  var runtime = new $RuntimeOptions{};
  return getChatappPhoneNumberMetricWithOptions(request, runtime);
}

model GetChatappTemplateDetailRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code. This parameter is used to verify whether the user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).

This parameter is required.', example='en_US'),
  templateCode?: string(name='TemplateCode', description='The code of the message template.', example='****4b5c79c9432497a075bdfca36bf5'),
  templateName?: string(name='TemplateName', description='Name of a template.', example='test_name'),
  templateType?: string(name='TemplateType', description='The type of the message template. Valid values:

*   **WHATSAPP**
*   **VIBER**
*   LINE (developing)', example='WHATSAPP'),
}

model GetChatappTemplateDetailResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='Access denied details.', example='None'),
  code?: string(name='Code', description='The HTTP status code.

*   Example: OK. This value indicates that the request is successful.
*   Other codes indicate that the request fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    auditStatus?: string(name='AuditStatus', description='The review status of the message template. Valid values:

*   **pass**: The message template is approved.
*   **fail**: The message template is rejected.
*   **auditing**: The message template is being reviewed.
*   **unaudit**: The review is suspended.', example='pass'),
    category?: string(name='Category', description='The category of the template when the returned value of TemplateType is WHATSAPP. Valid values:

*   **UTILITY**: a transactional template
*   **MARKETING**: a marketing template
*   **AUTHENTICATION**: an identity authentication template

The category of the template when the returned value of the TemplateType parameter is VIBER. Valid values:

*   **text**: a template that contains only text
*   **image**: a template that contains only images
*   **text_image_button**: a template that contains text, images, and buttons
*   **text_button**: a template that contains text and buttons
*   **document**: a template that contains only files
*   **video**: a template that contains only videos
*   **text_video**: a template that contains text and videos
*   **text_video_button**: a template that contains text, videos, and buttons
*   **text_image**: a template that contains text and images

> If Category is set to text_video_button, users cannot open a web page by clicking the button. Users can open only the video in the message. In this case, you do not need to specify the Url parameter for the URL button in the template.', example='TRANSACTIONAL'),
    components?: [ 
      {
        addSecretRecommendation?: boolean(name='AddSecretRecommendation', description='The note indicating that customers cannot share verification codes with others. The note is displayed in the message body. This parameter is valid if Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to BODY for a WhatsApp message template.', example='false'),
        buttons?: [ 
          {
            autofillText?: string(name='AutofillText', description='The text of the one-tap autofill button. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP in a WhatsApp message template.', example='Autofill'),
            couponCode?: string(name='CouponCode', description='The coupon code.', example='202039ksjs'),
            extendAttrs?: {
              action?: string(name='Action', description='The event type.', example='nextCard'),
              intentCode?: string(name='IntentCode', description='The intent code.', example='test'),
              nextLanguageCode?: string(name='NextLanguageCode', description='The language of the next template.', example='en'),
              nextTemplateCode?: string(name='NextTemplateCode', description='The code of the next template.', example='20939920093993'),
              nextTemplateName?: string(name='NextTemplateName', description='The name of the next template.', example='abc'),
            }(name='ExtendAttrs', description='The extended fields.'),
            flowAction?: string(name='FlowAction', description='The Flow action. Valid values: NAVIGATE and DATA_EXCHANGE.', example='NAVIGATE'),
            flowId?: string(name='FlowId', description='The Flow ID.', example='3838292983'),
            isOptOut?: boolean(name='IsOptOut', description='The unsubscribe button. This parameter is valid if Category is set to MARKETING and the Type sub-parameter of the Buttons parameter is set to QUICK_REPLY for a WhatsApp message template. Marketing messages will not be sent to customers if you configure message sending in the Chat App Message Service console and the customers click this button.', example='false'),
            navigateScreen?: string(name='NavigateScreen', description='The first screen in the Flow. This parameter is returned if FlowAction is set to NAVIGATE.', example='DETAILS'),
            packageName?: string(name='PackageName', description='The app package name that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP in a WhatsApp message template.', example='com.aliyun'),
            phoneNumber?: string(name='PhoneNumber', description='The phone number. This parameter is valid only if the Type sub-parameter of the Buttons parameter is set to **PHONE_NUMBER**.', example='861398745****'),
            signatureHash?: string(name='SignatureHash', description='The app signing key hash that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP in a WhatsApp message template.', example='2993839'),
            supportedApps?: [ 
              {
                packageName?: string(name='PackageName', description='The app package name.', example='com.test'),
                signatureHash?: string(name='SignatureHash', description='The app signing key hash.', example='29kdkeik939'),
              }
            ](name='SupportedApps', description='The apps that support one-tap authentication and zero-tap authentication.'),
            text?: string(name='Text', description='The display name of the button.', example='Call'),
            type?: string(name='Type', description='The button type. Valid values:

*   **PHONE_NUMBER**: phone call button
*   **URL**: URL button
*   **QUICK_REPLY**: quick reply button
*   **COPY_CODE**: copy code button
*   **ONE_TAP**: one-tap autofill button if Category is set to AUTHENTICATION

> 

*   If Category is set to AUTHENTICATION for a WhatsApp message template, you can add only one button to the WhatsApp message template and you must set the Type sub-parameter of the Buttons parameter to COPY_CODE or ONE_TAP. If Type is set to COPY_CODE, the Text sub-parameter of the Buttons parameter is required. If Type is set to ONE_TAP, the Text, SignatureHash, PackageName, and AutofillText sub-parameters of the Buttons parameter are required. The value of Text is displayed if the desired app is not installed on the device. The value of Text indicates that you must manually copy the verification code.

*   You can add only one button to a Viber message template, and you must set the Type sub-parameter of the Buttons parameter to URL.', example='PHONE_NUMBER'),
            url?: string(name='Url', description='The URL to which you are redirected when you click the URL button.', example='https://example.com'),
            urlType?: string(name='UrlType', description='The URL type. Valid values:

*   **static**
*   **dynamic**', example='static'),
          }
        ](name='Buttons', description='The buttons. This parameter is returned only if the Type sub-parameter of the Components parameter is set to **BUTTONS**.

>  ####

*   A marketing or utility WhatsApp message template can contain up to 10 buttons.

*   A WhatsApp message template can contain only one phone call button.

*   A WhatsApp message template can contain up to two URL buttons.

*   In a WhatsApp message template, a quick reply button cannot be used together with a phone call button or a URL button.'),
        caption?: string(name='Caption', description='The description of the document.', example='The new file has been uploaded.'),
        cards?: [ 
          {
            cardComponents?: [ 
              {
                buttons?: [ 
                  {
                    phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='+86138000'),
                    text?: string(name='Text', description='The button text.', example='Button text'),
                    type?: string(name='Type', description='The type of the button in the carousel template. Valid values: URL, PHONE_NUMBER, and QUICK_REQLY.', example='URL'),
                    url?: string(name='Url', description='The URL to which you are redirected when you click the URL button.', example='https://aliyun.com'),
                    urlType?: string(name='UrlType', description='The type of the URL. Valid values: static and dynamic.', example='static'),
                  }
                ](name='Buttons', description='The buttons of the carousel card.'),
                format?: string(name='Format', description='The type of the header in the carousel template. The header can only be an image or a video. The headers of all carousel cards must be the same. The type of the media resources that are included in the message. Valid values: IMGAGE and VIDEO.', example='HEADER'),
                text?: string(name='Text', description='The text of the carousel card.', example='Body'),
                type?: string(name='Type', description='The component type.', example='HEADER'),
                url?: string(name='Url', description='The URL.', example='https://aliyun.com'),
              }
            ](name='CardComponents', description='The components of the carousel card.'),
          }
        ](name='Cards', description='The carousel cards.'),
        codeExpirationMinutes?: int32(name='CodeExpirationMinutes', description='The validity period of the verification code in the WhatsApp authentication template. Unit: minutes. This parameter is valid only when Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to FOOTER for a WhatsApp message template. The validity period of the verification code is displayed in the footer.', example='5'),
        duration?: int32(name='Duration', description='The length of the video in the Viber message template. Unit: seconds. Valid values: 0 to 600.', example='50'),
        fileName?: string(name='FileName', description='The name of the document.', example='Express file'),
        fileType?: string(name='FileType', description='The type of the document attached in the Viber message template.', example='docx'),
        format?: string(name='Format', description='The format.', example='TEXT'),
        latitude?: string(name='Latitude', description='The latitude of the location.', example='28.001'),
        locationAddress?: string(name='LocationAddress', description='The address of the location.', example='Hangzhou'),
        locationName?: string(name='LocationName', description='The name of the location.', example='Hangzhou'),
        longitude?: string(name='Longitude', description='The longitude of the location.', example='120.002'),
        offerExpirationTimeMs?: string(name='OfferExpirationTimeMs', description='The variable when the coupon code expires in the limited-time offer template.', example='$(offerExpirationTimeMs)'),
        text?: string(name='Text', description='The text of the message that you want to send.', example='Hello'),
        thumbUrl?: string(name='ThumbUrl', description='The thumbnail URL of the video in the Viber message template.', example='https://img.png'),
        type?: string(name='Type', description='The component type. Valid values:

*   **BODY**
*   **HEADER**
*   **FOOTER**
*   **BUTTONS**
*   **CAROUSEL**
*   **LIMITED_TIME_OFFER**

> 

*   In a WhatsApp message template, a **Body** component cannot exceed 1,024 characters in length. A **HEADER** or **FOOTER** component cannot exceed 60 characters in length.

*   **FOOTER**, **CAROUSEL**, and **LIMITED_TIME_OFFER** components are not supported in Viber message templates.

*   In Viber message templates, media resources such as images, videos, and documents are placed in the **HEADER** component. If a Viber message contains text and an image, the image is placed below the text in the message received on a device.', example='BODY'),
        url?: string(name='Url', description='The URL of the media resource.', example='https://image.developer.aliyundoc.com'),
        hasExpiration?: boolean(name='hasExpiration', description='Indicates whether the coupon code has an expiration time in the limited-time offer template.', example='true'),
      }
    ](name='Components', description='The components of the message template.'),
    example?: map[string]string(name='Example', description='The examples of variables.'),
    language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).', example='en_US'),
    messageSendTtlSeconds?: int32(name='MessageSendTtlSeconds', description='The validity period of the WhatsApp authentication message.', example='120'),
    name?: string(name='Name', description='The name of the message template.', example='hello_whatsapp'),
    qualityScore?: string(name='QualityScore', description='The quality of the template.', example='GREEN'),
    reason?: string(name='Reason', description='The reason why the template was rejected.', example='None'),
    templateCode?: string(name='TemplateCode', description='The code of the message template.', example='744c4b5c79c9432497a075bdfca3****'),
    templateType?: string(name='TemplateType', description='The type of the message template. Valid values:

*   **WHATSAPP**
*   **VIBER**
*   LINE (developing)', example='WHATSAPP'),
  }(name='Data', description='The returned data.', example='{ 		"category": "ACCOUNT_UPDATE", 		"name": "account_notice", 		"language": "en_US", 		"templateCode": "744c4b5c79c9432497a075bdfca3****", 		"auditStatus": "APPROVED", 		"components": "[{\\\\"type\\\\":\\\\"BODY\\\\",\\\\"text\\\\":\\\\"body_text$(textVariable)\\\\"},{\\\\"type\\\\":\\\\"HEADER\\\\",\\\\"formate\\\\":\\\\"IMAGE\\\\",\\\\"url\\\\":\\\\"$(linkVariable)\\\\"},{\\\\"type\\\\":\\\\"FOOTER\\\\",\\\\"text\\\\":\\\\"footer-text\\\\"},{\\\\"type\\\\":\\\\"BUTTONS\\\\",\\\\"buttons\\\\":[{\\\\"type\\\\":\\\\"PHONE_NUMBER\\\\",\\\\"text\\\\":\\\\"phone-button-text\\\\",\\\\"phone_number\\\\":\\\\"+861388888****\\\\"},{\\\\"type\\\\":\\\\"URL\\\\",\\\\"text\\\\":\\\\"url-button-text\\\\",\\\\"url\\\\":\\\\"https://www.website.com/\\\\"}]}]", 		"example": "{\\\\"textVariable\\\\": \\\\"text\\\\", \\\\"linkVariable\\\\": \\\\"link\\\\"}" 	}'),
  message?: string(name='Message', description='The error message.', example='User not authorized to operate on the specified resource.'),
  requestId?: string(name='RequestId', description='The request ID.', example='744c4b5c79c9432497a075bdfca3****'),
}

model GetChatappTemplateDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetChatappTemplateDetailResponseBody(name='body'),
}

/**
 * @summary Queries the information of a message template.
 *
 * @description ### QPS limit
 * You can call this API operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappTemplateDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetChatappTemplateDetailResponse
 */
async function getChatappTemplateDetailWithOptions(request: GetChatappTemplateDetailRequest, runtime: $RuntimeOptions): GetChatappTemplateDetailResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.custWabaId)) {
    query['CustWabaId'] = request.custWabaId;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.templateCode)) {
    query['TemplateCode'] = request.templateCode;
  }
  if (!$isNull(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  if (!$isNull(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetChatappTemplateDetail',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information of a message template.
 *
 * @description ### QPS limit
 * You can call this API operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappTemplateDetailRequest
 * @return GetChatappTemplateDetailResponse
 */
async function getChatappTemplateDetail(request: GetChatappTemplateDetailRequest): GetChatappTemplateDetailResponse {
  var runtime = new $RuntimeOptions{};
  return getChatappTemplateDetailWithOptions(request, runtime);
}

model GetChatappTemplateMetricRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the ISV account.', example='293483938849493'),
  end?: long(name='End', description='The end of the time range to query.

This parameter is required.', example='1693407714687'),
  granularity?: string(name='Granularity', description='The granularity of the metric.

Valid values:

*   DAILY
*   HALF_HOUR', example='DAILY'),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code, which is used to verify whether the RAM user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  language?: string(name='Language', description='The template language.', example='en'),
  start?: long(name='Start', description='The beginning of the time range to query.

This parameter is required.', example='1693107714687'),
  templateCode?: string(name='TemplateCode', description='The template code.

This parameter is required.', example='744c4b5c79c9432497a075bdfca36bf5'),
  templateType?: string(name='TemplateType', description='The template type. If you do not specify this parameter, the default value WHATSAPP is used.

Valid values:

*   VIBER
*   WHATSAPP', example='WHATSAPP'),
}

model GetChatappTemplateMetricResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The value OK indicates that the request was successful.', example='OK'),
  data?: [ 
    {
      cliented?: [ 
        {
          buttonContent?: string(name='ButtonContent', description='The text on the button.', example='Open url'),
          count?: int32(name='Count', description='The number of clicks.', example='20'),
          type?: string(name='Type', description='The button type.

Valid values:

*   phone_number_button
*   url_button
*   quick_relpy_button', example='quick_reply_button'),
        }
      ](name='Cliented', description='The statistics on button clicks.'),
      deliveredCount?: int32(name='DeliveredCount', description='The number of delivered messages.', example='6'),
      end?: long(name='End', description='The end of the time range you queried.', example='1668138331485'),
      language?: string(name='Language', description='The template language.', example='en'),
      readCount?: int32(name='ReadCount', description='The number of read messages.', example='3'),
      sentCount?: int32(name='SentCount', description='The number of sent messages.', example='10'),
      start?: long(name='Start', description='The beginning of the time range you queried.', example='1673919240001'),
      templateCode?: string(name='TemplateCode', description='The template code.', example='83837774838*****'),
    }
  ](name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model GetChatappTemplateMetricResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetChatappTemplateMetricResponseBody(name='body'),
}

/**
 * @summary Queries the metrics about a marketing template.
 *
 * @description You can call this operation up to 50 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappTemplateMetricRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetChatappTemplateMetricResponse
 */
async function getChatappTemplateMetricWithOptions(request: GetChatappTemplateMetricRequest, runtime: $RuntimeOptions): GetChatappTemplateMetricResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.end)) {
    query['End'] = request.end;
  }
  if (!$isNull(request.granularity)) {
    query['Granularity'] = request.granularity;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.start)) {
    query['Start'] = request.start;
  }
  if (!$isNull(request.templateCode)) {
    query['TemplateCode'] = request.templateCode;
  }
  if (!$isNull(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetChatappTemplateMetric',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the metrics about a marketing template.
 *
 * @description You can call this operation up to 50 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappTemplateMetricRequest
 * @return GetChatappTemplateMetricResponse
 */
async function getChatappTemplateMetric(request: GetChatappTemplateMetricRequest): GetChatappTemplateMetricResponse {
  var runtime = new $RuntimeOptions{};
  return getChatappTemplateMetricWithOptions(request, runtime);
}

model GetChatappUploadAuthorizationRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493'),
}

model GetChatappUploadAuthorizationResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='Access denied for detailed information.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    accessKeyId?: string(name='AccessKeyId', description='The AccessKey ID that is used to authorize a user to upload a file to Object Storage Service (OSS).', example='2skeuurfj****'),
    accessKeySecret?: string(name='AccessKeySecret', description='The AccessKey secret that is used to authorize a user to upload a file to OSS.', example='skdkdukeuuuu****'),
    bucketName?: string(name='BucketName', description='The name of the bucket to which a file is uploaded in OSS.', example='oss'),
    dir?: string(name='Dir', description='The directory to which the file is uploaded in Object Storage Service (OSS).', example='1000102939'),
    endPoint?: string(name='EndPoint', description='The address of the OSS server to which a file is uploaded.', example='https://oss.com'),
    expire?: int32(name='Expire', description='The timeout period.', example='3600'),
    securityToken?: string(name='SecurityToken', description='The security token.', example='dkdieiii**'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message returned.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model GetChatappUploadAuthorizationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetChatappUploadAuthorizationResponseBody(name='body'),
}

/**
 * @summary Obtains the authentication information that is used to upload a file.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappUploadAuthorizationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetChatappUploadAuthorizationResponse
 */
async function getChatappUploadAuthorizationWithOptions(request: GetChatappUploadAuthorizationRequest, runtime: $RuntimeOptions): GetChatappUploadAuthorizationResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetChatappUploadAuthorization',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the authentication information that is used to upload a file.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappUploadAuthorizationRequest
 * @return GetChatappUploadAuthorizationResponse
 */
async function getChatappUploadAuthorization(request: GetChatappUploadAuthorizationRequest): GetChatappUploadAuthorizationResponse {
  var runtime = new $RuntimeOptions{};
  return getChatappUploadAuthorizationWithOptions(request, runtime);
}

model GetChatappVerifyCodeRequest {
  custSpaceId?: string(name='CustSpaceId', description='This parameter is required.', example='cams-kei****'),
  locale?: string(name='Locale', description='This parameter is required.', example='zh_CN'),
  method?: string(name='Method', description='This parameter is required.', example='sms'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='This parameter is required.', example='8613800000000'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model GetChatappVerifyCodeResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='None.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='1612C226-E271-4CFE-9F18-4066D550F91B'),
  success?: boolean(name='Success', example='true'),
}

model GetChatappVerifyCodeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetChatappVerifyCodeResponseBody(name='body'),
}

/**
 * @summary Obtains a verification code.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappVerifyCodeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetChatappVerifyCodeResponse
 */
async function getChatappVerifyCodeWithOptions(request: GetChatappVerifyCodeRequest, runtime: $RuntimeOptions): GetChatappVerifyCodeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.locale)) {
    query['Locale'] = request.locale;
  }
  if (!$isNull(request.method)) {
    query['Method'] = request.method;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetChatappVerifyCode',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains a verification code.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetChatappVerifyCodeRequest
 * @return GetChatappVerifyCodeResponse
 */
async function getChatappVerifyCode(request: GetChatappVerifyCodeRequest): GetChatappVerifyCodeResponse {
  var runtime = new $RuntimeOptions{};
  return getChatappVerifyCodeWithOptions(request, runtime);
}

model GetCommerceSettingRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='1380000****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model GetCommerceSettingResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='Access denied for detailed information.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   Other values indicate that the request failed. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    cartEnable?: boolean(name='CartEnable', description='Indicates whether the shopping cart button is displayed. Valid values:

*   true
*   false', example='false'),
    catalogVisible?: boolean(name='CatalogVisible', description='Indicates whether the catalog button is displayed. Valid values:

*   true
*   false', example='false'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model GetCommerceSettingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetCommerceSettingResponseBody(name='body'),
}

/**
 * @summary Queries the business settings of a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetCommerceSettingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetCommerceSettingResponse
 */
async function getCommerceSettingWithOptions(request: GetCommerceSettingRequest, runtime: $RuntimeOptions): GetCommerceSettingResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetCommerceSetting',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the business settings of a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetCommerceSettingRequest
 * @return GetCommerceSettingResponse
 */
async function getCommerceSetting(request: GetCommerceSettingRequest): GetCommerceSettingResponse {
  var runtime = new $RuntimeOptions{};
  return getCommerceSettingWithOptions(request, runtime);
}

model GetConversationalAutomationRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account or the instance ID of the customer of Alibaba Cloud.

This parameter is required.', example='cams-3ie***'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number of the enterprise.

This parameter is required.', example='86130000***'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model GetConversationalAutomationResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   For more information about other response codes, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    commands?: [ 
      {
        commandDescription?: string(name='CommandDescription', description='The description of the command.', example='description'),
        commandName?: string(name='CommandName', description='The name of the command.', example='common1'),
      }
    ](name='Commands', description='The commands.'),
    enableWelcomeMessage?: boolean(name='EnableWelcomeMessage', description='Indicates whether the welcoming message is enabled.', example='true'),
    phoneNumber?: string(name='PhoneNumber', description='The phone number of the enterprise.', example='86138****'),
    prompts?: [ string ](name='Prompts', description='The opening remarks.'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the call was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model GetConversationalAutomationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetConversationalAutomationResponseBody(name='body'),
}

/**
 * @summary Configures welcoming messages, opening remarks, and commands.
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * This operation will directly obtain data from Facebook, which sets an upper limit on the total number of calls for operations. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetConversationalAutomationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetConversationalAutomationResponse
 */
async function getConversationalAutomationWithOptions(request: GetConversationalAutomationRequest, runtime: $RuntimeOptions): GetConversationalAutomationResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetConversationalAutomation',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Configures welcoming messages, opening remarks, and commands.
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * This operation will directly obtain data from Facebook, which sets an upper limit on the total number of calls for operations. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetConversationalAutomationRequest
 * @return GetConversationalAutomationResponse
 */
async function getConversationalAutomation(request: GetConversationalAutomationRequest): GetConversationalAutomationResponse {
  var runtime = new $RuntimeOptions{};
  return getConversationalAutomationWithOptions(request, runtime);
}

model GetFlowRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='99384883'),
  flowId?: string(name='FlowId', description='The Flow ID.

This parameter is required.', example='flow_001'),
}

model GetFlowResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: {
    categories?: [ string ](name='Categories', description='The categories of the Flow.'),
    dataApiVersion?: string(name='DataApiVersion', description='The version number of the API.', example='3.0'),
    flowId?: string(name='FlowId', description='The Flow ID.', example='flow_id_arms'),
    flowName?: string(name='FlowName', description='The Flow name.', example='dnjn'),
    JSONVersion?: string(name='JSONVersion', description='The JSON version.', example='2.1'),
    previewUrl?: string(name='PreviewUrl', description='The temporary preview URL.', example='https://pre-url'),
    previewUrlExpires?: long(name='PreviewUrlExpires', description='The time when the preview URL expires. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1700617436633'),
    status?: string(name='Status', description='The state of the Flow.

Valid values:

*   PUBLISHED

    <!-- -->

    <!-- -->

    <!-- -->

*   DRAFT

    <!-- -->

    <!-- -->

    <!-- -->

*   DEPRECATED

    <!-- -->

    <!-- -->

    <!-- -->', example='DRAFT'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model GetFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFlowResponseBody(name='body'),
}

/**
 * @summary Queries the information about a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFlowResponse
 */
async function getFlowWithOptions(request: GetFlowRequest, runtime: $RuntimeOptions): GetFlowResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetFlowRequest
 * @return GetFlowResponse
 */
async function getFlow(request: GetFlowRequest): GetFlowResponse {
  var runtime = new $RuntimeOptions{};
  return getFlowWithOptions(request, runtime);
}

model GetFlowJSONAssestRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='83883873'),
  flowId?: string(name='FlowId', description='The Flow ID.

This parameter is required.', example='flow_001'),
}

model GetFlowJSONAssestResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: {
    filePath?: string(name='FilePath', description='The file path.', example='https://url.com/json.json'),
    flowId?: string(name='FlowId', description='The Flow ID.', example='flow_id_arms'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='Error description information.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model GetFlowJSONAssestResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFlowJSONAssestResponseBody(name='body'),
}

/**
 * @summary Queries the JSON content of a Flow.
 *
 * @param request GetFlowJSONAssestRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFlowJSONAssestResponse
 */
async function getFlowJSONAssestWithOptions(request: GetFlowJSONAssestRequest, runtime: $RuntimeOptions): GetFlowJSONAssestResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetFlowJSONAssest',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the JSON content of a Flow.
 *
 * @param request GetFlowJSONAssestRequest
 * @return GetFlowJSONAssestResponse
 */
async function getFlowJSONAssest(request: GetFlowJSONAssestRequest): GetFlowJSONAssestResponse {
  var runtime = new $RuntimeOptions{};
  return getFlowJSONAssestWithOptions(request, runtime);
}

model GetFlowPreviewUrlRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='939399383'),
  flowId?: string(name='FlowId', description='The Flow ID.

This parameter is required.', example='flow_001'),
}

model GetFlowPreviewUrlResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: {
    flowId?: string(name='FlowId', description='The Flow ID.', example='6dd31e1b7cc940fc99e293d9952b5b79'),
    previewUrl?: string(name='PreviewUrl', description='The temporary preview URL.', example='https://url'),
    previewUrlExpires?: long(name='PreviewUrlExpires', description='The time when the preview URL expires. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1700617436633'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model GetFlowPreviewUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFlowPreviewUrlResponseBody(name='body'),
}

/**
 * @summary Obtains the preview URL of a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetFlowPreviewUrlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFlowPreviewUrlResponse
 */
async function getFlowPreviewUrlWithOptions(request: GetFlowPreviewUrlRequest, runtime: $RuntimeOptions): GetFlowPreviewUrlResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetFlowPreviewUrl',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the preview URL of a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetFlowPreviewUrlRequest
 * @return GetFlowPreviewUrlResponse
 */
async function getFlowPreviewUrl(request: GetFlowPreviewUrlRequest): GetFlowPreviewUrlResponse {
  var runtime = new $RuntimeOptions{};
  return getFlowPreviewUrlWithOptions(request, runtime);
}

model GetMigrationVerifyCodeRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493'),
  locale?: string(name='Locale', description='The language.

This parameter is required.', example='zh_CN'),
  method?: string(name='Method', description='The method to obtain the verification code. Valid values: SMS and VOICE.

This parameter is required.', example='sms'),
  phoneNumber?: string(name='PhoneNumber', description='Phone number.

This parameter is required.', example='8613800001234'),
}

model GetMigrationVerifyCodeResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    id?: string(name='Id', description='The ID of the number.', example='82828893332'),
    phoneNumber?: string(name='PhoneNumber', description='Phone number.', example='8613800001234'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model GetMigrationVerifyCodeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetMigrationVerifyCodeResponseBody(name='body'),
}

/**
 * @summary Obtain the verification code for the migration number.
 *
 * @description The single user QPS limit for this interface is 10 times per second. Exceeding the limit may result in restricted API calls, which may affect your business. Please make reasonable calls.
 *
 * @param request GetMigrationVerifyCodeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetMigrationVerifyCodeResponse
 */
async function getMigrationVerifyCodeWithOptions(request: GetMigrationVerifyCodeRequest, runtime: $RuntimeOptions): GetMigrationVerifyCodeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.locale)) {
    query['Locale'] = request.locale;
  }
  if (!$isNull(request.method)) {
    query['Method'] = request.method;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetMigrationVerifyCode',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtain the verification code for the migration number.
 *
 * @description The single user QPS limit for this interface is 10 times per second. Exceeding the limit may result in restricted API calls, which may affect your business. Please make reasonable calls.
 *
 * @param request GetMigrationVerifyCodeRequest
 * @return GetMigrationVerifyCodeResponse
 */
async function getMigrationVerifyCode(request: GetMigrationVerifyCodeRequest): GetMigrationVerifyCodeResponse {
  var runtime = new $RuntimeOptions{};
  return getMigrationVerifyCodeWithOptions(request, runtime);
}

model GetPermissionByCodeRequest {
  code?: string(name='Code', description='Authorize code information.

This parameter is required.', example='flow_001'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='393847477'),
  permissions?: [ string ](name='Permissions', description='The permissions.'),
}

model GetPermissionByCodeShrinkRequest {
  code?: string(name='Code', description='Authorize code information.

This parameter is required.', example='flow_001'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='393847477'),
  permissionsShrink?: string(name='Permissions', description='The permissions.'),
}

model GetPermissionByCodeResponseBody = {
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   For more information about other response codes, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='Error description information.', example='SUCCESS'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model GetPermissionByCodeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPermissionByCodeResponseBody(name='body'),
}

/**
 * @summary Obtains permissions based on the authorization code obtained from embedded signup.
 *
 * @param tmpReq GetPermissionByCodeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPermissionByCodeResponse
 */
async function getPermissionByCodeWithOptions(tmpReq: GetPermissionByCodeRequest, runtime: $RuntimeOptions): GetPermissionByCodeResponse {
  tmpReq.validate();
  var request = new GetPermissionByCodeShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.permissions)) {
    request.permissionsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.permissions, 'Permissions', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.code)) {
    body['Code'] = request.code;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.permissionsShrink)) {
    body['Permissions'] = request.permissionsShrink;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetPermissionByCode',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains permissions based on the authorization code obtained from embedded signup.
 *
 * @param request GetPermissionByCodeRequest
 * @return GetPermissionByCodeResponse
 */
async function getPermissionByCode(request: GetPermissionByCodeRequest): GetPermissionByCodeResponse {
  var runtime = new $RuntimeOptions{};
  return getPermissionByCodeWithOptions(request, runtime);
}

model GetPhoneEncryptionPublicKeyRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the independent software vendor (ISV) account.', example='393838848'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='flow_001'),
}

model GetPhoneEncryptionPublicKeyResponseBody = {
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   For more information about other response codes, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    encryptionPublicKey?: string(name='EncryptionPublicKey', description='The public key.', example='-----BEGIN PUBLIC KEY-----
AAA
BBB
CCC
DDD
EEE
FFF
GGG
-----END PUBLIC KEY-----'),
    encryptionPublicKeyStatus?: string(name='EncryptionPublicKeyStatus', description='The validity state of the public key. Valid values:

*   MISMATCH: The public key is invalid.
*   VALID: The public key is valid.', example='VALID'),
    phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='86138000**'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='Error description information.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model GetPhoneEncryptionPublicKeyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPhoneEncryptionPublicKeyResponseBody(name='body'),
}

/**
 * @summary Queries the encryption public key of a phone number.
 *
 * @param request GetPhoneEncryptionPublicKeyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPhoneEncryptionPublicKeyResponse
 */
async function getPhoneEncryptionPublicKeyWithOptions(request: GetPhoneEncryptionPublicKeyRequest, runtime: $RuntimeOptions): GetPhoneEncryptionPublicKeyResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetPhoneEncryptionPublicKey',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the encryption public key of a phone number.
 *
 * @param request GetPhoneEncryptionPublicKeyRequest
 * @return GetPhoneEncryptionPublicKeyResponse
 */
async function getPhoneEncryptionPublicKey(request: GetPhoneEncryptionPublicKeyRequest): GetPhoneEncryptionPublicKeyResponse {
  var runtime = new $RuntimeOptions{};
  return getPhoneEncryptionPublicKeyWithOptions(request, runtime);
}

model GetPhoneNumberVerificationStatusRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the ISV account.

This parameter is required.', example='229393838****'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='8613900001234'),
}

model GetPhoneNumberVerificationStatusResponseBody = {
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    codeVerificationStatus?: string(name='CodeVerificationStatus', description='The verification status.', example='VERIFIED'),
    id?: string(name='Id', description='The ID of the number.', example='2224342624'),
    phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='8613900001234'),
  }(name='Data', description='The data returned.'),
  message?: string(name='Message', description='The error message returned.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2D'),
}

model GetPhoneNumberVerificationStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPhoneNumberVerificationStatusResponseBody(name='body'),
}

/**
 * @summary Obtains the verification status of a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetPhoneNumberVerificationStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPhoneNumberVerificationStatusResponse
 */
async function getPhoneNumberVerificationStatusWithOptions(request: GetPhoneNumberVerificationStatusRequest, runtime: $RuntimeOptions): GetPhoneNumberVerificationStatusResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetPhoneNumberVerificationStatus',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the verification status of a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetPhoneNumberVerificationStatusRequest
 * @return GetPhoneNumberVerificationStatusResponse
 */
async function getPhoneNumberVerificationStatus(request: GetPhoneNumberVerificationStatusRequest): GetPhoneNumberVerificationStatusResponse {
  var runtime = new $RuntimeOptions{};
  return getPhoneNumberVerificationStatusWithOptions(request, runtime);
}

model GetPreValidatePhoneIdRequest {
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='861380000'),
  verifyCode?: string(name='VerifyCode', description='The verification code provided when you purchased the pre-registered phone number.

This parameter is required.', example='208393'),
}

model GetPreValidatePhoneIdResponseBody = {
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   For more information about other response codes, see [Error codes](https://www.alibabacloud.com/help/zh/cams/latest/api-error-codes).', example='OK'),
  data?: {
    phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='929833'),
    phoneNumberId?: string(name='PhoneNumberId', description='The ID of the phone number.', example='8613800000000'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model GetPreValidatePhoneIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetPreValidatePhoneIdResponseBody(name='body'),
}

/**
 * @summary Obtains the ID of a pre-registered phone number used for embedded signup without the need to re-obtain a verification code.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetPreValidatePhoneIdRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetPreValidatePhoneIdResponse
 */
async function getPreValidatePhoneIdWithOptions(request: GetPreValidatePhoneIdRequest, runtime: $RuntimeOptions): GetPreValidatePhoneIdResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.verifyCode)) {
    body['VerifyCode'] = request.verifyCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetPreValidatePhoneId',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the ID of a pre-registered phone number used for embedded signup without the need to re-obtain a verification code.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetPreValidatePhoneIdRequest
 * @return GetPreValidatePhoneIdResponse
 */
async function getPreValidatePhoneId(request: GetPreValidatePhoneIdRequest): GetPreValidatePhoneIdResponse {
  var runtime = new $RuntimeOptions{};
  return getPreValidatePhoneIdWithOptions(request, runtime);
}

model GetWhatsappConnectionCatalogRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.', example='C2020939922929292'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  wabaId?: string(name='WabaId', description='The WABA ID.

This parameter is required.', example='292939399393'),
}

model GetWhatsappConnectionCatalogResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   Other values indicate that the request failed. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='success'),
  model?: map[string]any(name='Model', description='The returned data.', example='{"id":"200292992"}'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='false'),
}

model GetWhatsappConnectionCatalogResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetWhatsappConnectionCatalogResponseBody(name='body'),
}

/**
 * @summary Queries the product catalogs that are associated with a WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetWhatsappConnectionCatalogRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetWhatsappConnectionCatalogResponse
 */
async function getWhatsappConnectionCatalogWithOptions(request: GetWhatsappConnectionCatalogRequest, runtime: $RuntimeOptions): GetWhatsappConnectionCatalogResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.wabaId)) {
    query['WabaId'] = request.wabaId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetWhatsappConnectionCatalog',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the product catalogs that are associated with a WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetWhatsappConnectionCatalogRequest
 * @return GetWhatsappConnectionCatalogResponse
 */
async function getWhatsappConnectionCatalog(request: GetWhatsappConnectionCatalogRequest): GetWhatsappConnectionCatalogResponse {
  var runtime = new $RuntimeOptions{};
  return getWhatsappConnectionCatalogWithOptions(request, runtime);
}

model GetWhatsappHealthStatusRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account or the instance ID of the customer of Alibaba Cloud.

This parameter is required.', example='2993****'),
  language?: string(name='Language', description='The template language.', example='en'),
  nodeType?: string(name='NodeType', description='The node type.

Valid values:

*   template: message template
*   phone: phone number
*   waba: WhatsApp Business Account (WABA)

This parameter is required.', example='waba'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number of the enterprise.', example='86138***'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  templateCode?: string(name='TemplateCode', description='The template code.', example='399299***'),
  wabaId?: string(name='WabaId', description='WabaId', example='299399****'),
}

model GetWhatsappHealthStatusResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   For more information about other response codes, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    canSendMessage?: string(name='CanSendMessage', description='Indicates whether the messages can be sent.', example='AVAILABLE'),
    entities?: [ 
      {
        businessId?: string(name='BusinessId', description='The Business Manager ID.', example='3992****'),
        canSendMessage?: string(name='CanSendMessage', description='Indicates whether the messages can be sent.', example='AVAILABLE'),
        entityType?: string(name='EntityType', description='The entity type.', example='PHONE_NUMBER'),
        errors?: [ 
          {
            errorCode?: string(name='ErrorCode', description='The error code.', example='141006'),
            errorDescription?: string(name='ErrorDescription', description='The description of the error.', example='There is an error with the payment method.'),
            possibleSolution?: string(name='PossibleSolution', description='The possible solution to the error.', example='There was an error with your payment method. Please add a new payment method to the account.'),
          }
        ](name='Errors', description='The reasons why the messages failed to be sent.'),
        language?: string(name='Language', description='The template language.', example='en'),
        phoneNumber?: string(name='PhoneNumber', description='The phone number to which the messages are sent.', example='86138****'),
        templateCode?: string(name='TemplateCode', description='The template code. This parameter is returned when the NodeType parameter is set to **template**.', example='939928****'),
        wabaId?: string(name='WabaId', description='The WABA ID. You can view the WABA ID in the Chat App Message Service console after you create the WABA.', example='39939***'),
      }
    ](name='Entities', description='The queried entities.'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='DAC72B08-3327-33EF-BEDC-8EC3E83A6575'),
  success?: boolean(name='Success', description='Indicates whether the call was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model GetWhatsappHealthStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetWhatsappHealthStatusResponseBody(name='body'),
}

/**
 * @summary Queries the messaging health status of different types of nodes.
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * This operation will directly obtain data from Facebook, which sets an upper limit on the total number of calls for operations. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetWhatsappHealthStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetWhatsappHealthStatusResponse
 */
async function getWhatsappHealthStatusWithOptions(request: GetWhatsappHealthStatusRequest, runtime: $RuntimeOptions): GetWhatsappHealthStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.nodeType)) {
    query['NodeType'] = request.nodeType;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.templateCode)) {
    query['TemplateCode'] = request.templateCode;
  }
  if (!$isNull(request.wabaId)) {
    query['WabaId'] = request.wabaId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetWhatsappHealthStatus',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the messaging health status of different types of nodes.
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * This operation will directly obtain data from Facebook, which sets an upper limit on the total number of calls for operations. We recommend that you take note of the limit when you call this operation.
 *
 * @param request GetWhatsappHealthStatusRequest
 * @return GetWhatsappHealthStatusResponse
 */
async function getWhatsappHealthStatus(request: GetWhatsappHealthStatusRequest): GetWhatsappHealthStatusResponse {
  var runtime = new $RuntimeOptions{};
  return getWhatsappHealthStatusWithOptions(request, runtime);
}

model IsvGetAppIdRequest {
  permissions?: string(name='Permissions', description='The permission.

Valid values:

*   whatsapp_business_messaging: sending permission on WhatsApp messages
*   ads_management: management permission on advertisements
*   catalog_management: management permission on catalogs', example='catalog_management'),
  type?: string(name='Type', description='The type of the app. Valid value: WHATSAPP.

This parameter is required.', example='WHATSAPP'),
}

model IsvGetAppIdResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  appId?: string(name='AppId', description='The message ID.', example='23hr3v'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  configId?: string(name='ConfigId', description='The ID of the configuration item.', example='28972951817****'),
  message?: string(name='Message', description='The error message returned.', example='null'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='744c4b5c79c9432497a075bdfca3***'),
}

model IsvGetAppIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: IsvGetAppIdResponseBody(name='body'),
}

/**
 * @summary Obtains the application ID under the ISV account.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request IsvGetAppIdRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return IsvGetAppIdResponse
 */
async function isvGetAppIdWithOptions(request: IsvGetAppIdRequest, runtime: $RuntimeOptions): IsvGetAppIdResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.permissions)) {
    body['Permissions'] = request.permissions;
  }
  if (!$isNull(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'IsvGetAppId',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the application ID under the ISV account.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request IsvGetAppIdRequest
 * @return IsvGetAppIdResponse
 */
async function isvGetAppId(request: IsvGetAppIdRequest): IsvGetAppIdResponse {
  var runtime = new $RuntimeOptions{};
  return isvGetAppIdWithOptions(request, runtime);
}

model ListChatappTemplateRequest {
  auditStatus?: string(name='AuditStatus', description='The review status of the message template. Valid values:

*   **pass**: The message template is approved.
*   **fail**: The message template is rejected.
*   **auditing**: The message template is being reviewed.
*   **unaudit**: The review is suspended.', example='pass'),
  category?: string(name='Category', example='AUTHENTICATION'),
  code?: string(name='Code', description='Template encoding.', example='838888822*****'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the ISV account.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code, which is used to verify whether the user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).', example='en'),
  name?: string(name='Name', description='The name of the message template.', example='hello_whatsapp'),
  ownerId?: long(name='OwnerId'),
  page?: {
    index?: int32(name='Index', description='The page number. Default value: 1.

This parameter is required.', example='1'),
    size?: int32(name='Size', description='The number of entries per page. Default value: 10.

This parameter is required.', example='10'),
  }(name='Page', description='The pagination settings.', example='"page": "{\\\\"index\\\\": 1,\\\\"size\\\\": 20}'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  templateType?: string(name='TemplateType', description='The type of the message template.

*   **WHATSAPP**
*   **VIBER**
*   LINE: the Line message template. This type of message template will be released later.', example='WHATSAPP'),
}

model ListChatappTemplateShrinkRequest {
  auditStatus?: string(name='AuditStatus', description='The review status of the message template. Valid values:

*   **pass**: The message template is approved.
*   **fail**: The message template is rejected.
*   **auditing**: The message template is being reviewed.
*   **unaudit**: The review is suspended.', example='pass'),
  category?: string(name='Category', example='AUTHENTICATION'),
  code?: string(name='Code', description='Template encoding.', example='838888822*****'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the ISV account.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code, which is used to verify whether the user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).', example='en'),
  name?: string(name='Name', description='The name of the message template.', example='hello_whatsapp'),
  ownerId?: long(name='OwnerId'),
  pageShrink?: string(name='Page', description='The pagination settings.', example='"page": "{\\\\"index\\\\": 1,\\\\"size\\\\": 20}'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  templateType?: string(name='TemplateType', description='The type of the message template.

*   **WHATSAPP**
*   **VIBER**
*   LINE: the Line message template. This type of message template will be released later.', example='WHATSAPP'),
}

model ListChatappTemplateResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  listTemplate?: [ 
    {
      auditStatus?: string(name='AuditStatus', description='The review state of the message template. Valid values:

*   **pass**: The message template is approved.
*   **fail**: The message template is rejected.
*   **auditing**: The message template is being reviewed.
*   **unaudit**: The review is suspended.', example='pass'),
      category?: string(name='Category', description='The category of the WhatsApp template. Valid values:

*   **UTILITY**: utility template
*   **MARKETING**: marketing template
*   **AUTHENTICATION**: authentication template

The category of the Viber template. Valid values:

*   **text**: template that contains only text
*   **image**: template that contains only an image
*   **text_image_button**: template that contains text, an image, and a button
*   **text_button**: template that contains text and a button
*   **document**: template that contains only a document
*   **video**: template that contains only a video
*   **text_video**: template that contains text and a video
*   **text_video_button**: template that contains text, a video, and a button
*   **text_image**: template that contains text and an image', example='TRANSACTIONAL'),
      language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).', example='en'),
      lastUpdateTime?: long(name='LastUpdateTime', description='The time when the template was last modified. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1711006633000'),
      reason?: string(name='Reason', description='The reason for the review failure.', example='None'),
      templateCode?: string(name='TemplateCode', description='The code of the message template.', example='744c4b5c79c9432497a075bdfca3****'),
      templateName?: string(name='TemplateName', description='The name of the message template.', example='hello_whatsapp'),
      templateType?: string(name='TemplateType', description='The type of the template. Valid values: WHATSAPP and VIBER.', example='WHATSAPP'),
    }
  ](name='ListTemplate', description='The list of the templates.'),
  message?: string(name='Message', description='The error message returned.', example='User not authorized to operate on the specified resource.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', example='false'),
  total?: int32(name='Total', description='The total number of entries returned.', example='1'),
}

model ListChatappTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListChatappTemplateResponseBody(name='body'),
}

/**
 * @summary Queries message templates.
 *
 * @description ### QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq ListChatappTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListChatappTemplateResponse
 */
async function listChatappTemplateWithOptions(tmpReq: ListChatappTemplateRequest, runtime: $RuntimeOptions): ListChatappTemplateResponse {
  tmpReq.validate();
  var request = new ListChatappTemplateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.page)) {
    request.pageShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.page, 'Page', 'json');
  }
  var query = {};
  if (!$isNull(request.auditStatus)) {
    query['AuditStatus'] = request.auditStatus;
  }
  if (!$isNull(request.category)) {
    query['Category'] = request.category;
  }
  if (!$isNull(request.code)) {
    query['Code'] = request.code;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.custWabaId)) {
    query['CustWabaId'] = request.custWabaId;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.language)) {
    query['Language'] = request.language;
  }
  if (!$isNull(request.name)) {
    query['Name'] = request.name;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.pageShrink)) {
    query['Page'] = request.pageShrink;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListChatappTemplate',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries message templates.
 *
 * @description ### QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListChatappTemplateRequest
 * @return ListChatappTemplateResponse
 */
async function listChatappTemplate(request: ListChatappTemplateRequest): ListChatappTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return listChatappTemplateWithOptions(request, runtime);
}

model ListFlowRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='99948484'),
  flowName?: string(name='FlowName', description='The name of the Flow that you want to query. If FlowName is left empty, the information about all Flows is queried.', example='flow_001'),
  page?: {
    index?: int32(name='Index', description='The page number.', example='1'),
    size?: int32(name='Size', description='The number of entries per page.', example='20'),
  }(name='Page', description='The returned pages.'),
}

model ListFlowShrinkRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.', example='99948484'),
  flowName?: string(name='FlowName', description='The name of the Flow that you want to query. If FlowName is left empty, the information about all Flows is queried.', example='flow_001'),
  pageShrink?: string(name='Page', description='The returned pages.'),
}

model ListFlowResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: [ 
    {
      categories?: [ string ](name='Categories', description='The categories of the Flows.'),
      flowId?: string(name='FlowId', description='The Flow ID.', example='3939393***'),
      flowName?: string(name='FlowName', description='The Flow name.', example='flow-02020'),
    }
  ](name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='1612C226-E271-4CFE-9F18-4066D550F91B'),
}

model ListFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFlowResponseBody(name='body'),
}

/**
 * @summary Queries a list of Flows.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq ListFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFlowResponse
 */
async function listFlowWithOptions(tmpReq: ListFlowRequest, runtime: $RuntimeOptions): ListFlowResponse {
  tmpReq.validate();
  var request = new ListFlowShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.page)) {
    request.pageShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.page, 'Page', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowName)) {
    body['FlowName'] = request.flowName;
  }
  if (!$isNull(request.pageShrink)) {
    body['Page'] = request.pageShrink;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of Flows.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListFlowRequest
 * @return ListFlowResponse
 */
async function listFlow(request: ListFlowRequest): ListFlowResponse {
  var runtime = new $RuntimeOptions{};
  return listFlowWithOptions(request, runtime);
}

model ListPhoneMessageQrdlRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='9383883'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number. Add the country code before the phone number.

This parameter is required.', example='861380000'),
}

model ListPhoneMessageQrdlResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: [ 
    {
      deepLinkUrl?: string(name='DeepLinkUrl', description='The URL of the deep link.', example='https://wa.msg/'),
      generateQrImage?: string(name='GenerateQrImage', description='The format of the generated image.', example='PNG'),
      phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='8613800'),
      prefilledMessage?: string(name='PrefilledMessage', description='The message content.', example='Hello'),
      qrImageUrl?: string(name='QrImageUrl', description='The URL of the QR code.', example='https://img.png'),
      qrdlCode?: string(name='QrdlCode', description='The mode of the quick-response (QR) code.', example='IUIED999'),
    }
  ](name='Data', description='The returned data.'),
  message?: string(name='Message', description='Error description information.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model ListPhoneMessageQrdlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListPhoneMessageQrdlResponseBody(name='body'),
}

/**
 * @summary Queries the information about a list of quick-response (QR) codes that contain messages.
 *
 * @param request ListPhoneMessageQrdlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListPhoneMessageQrdlResponse
 */
async function listPhoneMessageQrdlWithOptions(request: ListPhoneMessageQrdlRequest, runtime: $RuntimeOptions): ListPhoneMessageQrdlResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListPhoneMessageQrdl',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a list of quick-response (QR) codes that contain messages.
 *
 * @param request ListPhoneMessageQrdlRequest
 * @return ListPhoneMessageQrdlResponse
 */
async function listPhoneMessageQrdl(request: ListPhoneMessageQrdlRequest): ListPhoneMessageQrdlResponse {
  var runtime = new $RuntimeOptions{};
  return listPhoneMessageQrdlWithOptions(request, runtime);
}

model ListProductRequest {
  after?: string(name='After', description='The cursor that points to the end of the page of the returned data.', example='kdkii48jfjjei3'),
  before?: string(name='Before', description='The cursor that points to the beginning of the page of the returned data.', example='wiidkd939kek93'),
  catalogId?: string(name='CatalogId', description='The catalog ID.

This parameter is required.', example='29398389292'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='C29398388383'),
  fields?: string(name='Fields', description='The fields. Separate multiple fields with commas (,).

 see [product fields](https://help.aliyun.com/document_detail/2579419.html)', example='id,name'),
  limit?: long(name='Limit', description='The number of products to be queried. Valid values: 1 to 1000.', example='73'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  wabaId?: string(name='WabaId', description='The ID of the WhatsApp Business account (WABA).

This parameter is required.', example='38487474747'),
}

model ListProductResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   Other values indicate that the request failed. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  model?: {
    data?: [  map[string]any ](name='Data', description='The returned data.'),
    paging?: {
      cursors?: {
        after?: string(name='After', description='The cursor that points to the end of the page of the returned data.', example='sjsuueu83838'),
        before?: string(name='Before', description='The cursor that points to the beginning of the page of the returned data.', example='sjjsjdjjdjd83883'),
      }(name='Cursors', description='The cursors for pagination.'),
    }(name='Paging', description='The pagination details.'),
  }(name='Model', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model ListProductResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListProductResponseBody(name='body'),
}

/**
 * @summary Queries products in a product catalog.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListProductRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListProductResponse
 */
async function listProductWithOptions(request: ListProductRequest, runtime: $RuntimeOptions): ListProductResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.after)) {
    query['After'] = request.after;
  }
  if (!$isNull(request.before)) {
    query['Before'] = request.before;
  }
  if (!$isNull(request.catalogId)) {
    query['CatalogId'] = request.catalogId;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.fields)) {
    query['Fields'] = request.fields;
  }
  if (!$isNull(request.limit)) {
    query['Limit'] = request.limit;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.wabaId)) {
    query['WabaId'] = request.wabaId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListProduct',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries products in a product catalog.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListProductRequest
 * @return ListProductResponse
 */
async function listProduct(request: ListProductRequest): ListProductResponse {
  var runtime = new $RuntimeOptions{};
  return listProductWithOptions(request, runtime);
}

model ListProductCatalogRequest {
  after?: string(name='After', description='The cursor that points to the end of the page of the returned data.', example='kdkii48jfjjei3'),
  before?: string(name='Before', description='The cursor that points to the beginning of the page of the returned data.', example='wiidkd939kek93'),
  businessId?: long(name='BusinessId', description='The Business Manager ID.

This parameter is required.', example='28'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='293483938849493'),
  fields?: string(name='Fields', description='The fields. Separate multiple fields with commas (,).
see  [catalog fields](https://help.aliyun.com/document_detail/2579419.html)', example='id,name'),
  limit?: long(name='Limit', description='The number of catalogs to be queried. Valid values: 1 to 1000.', example='73'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ListProductCatalogResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   Other values indicate that the request failed. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  model?: {
    data?: [  map[string]any ](name='Data', description='The returned data.'),
    paging?: {
      cursors?: {
        after?: string(name='After', description='The cursor that points to the end of the page of the returned data.', example='sjsuueu83838'),
        before?: string(name='Before', description='The cursor that points to the beginning of the page of the returned data.', example='sjjsjdjjdjd83883'),
      }(name='Cursors', description='The cursors for pagination.'),
    }(name='Paging', description='The pagination details.'),
  }(name='Model', description='The returned data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model ListProductCatalogResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListProductCatalogResponseBody(name='body'),
}

/**
 * @summary Queries the product catalogs on the Business Manager platform of Meta.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListProductCatalogRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListProductCatalogResponse
 */
async function listProductCatalogWithOptions(request: ListProductCatalogRequest, runtime: $RuntimeOptions): ListProductCatalogResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.after)) {
    query['After'] = request.after;
  }
  if (!$isNull(request.before)) {
    query['Before'] = request.before;
  }
  if (!$isNull(request.businessId)) {
    query['BusinessId'] = request.businessId;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.fields)) {
    query['Fields'] = request.fields;
  }
  if (!$isNull(request.limit)) {
    query['Limit'] = request.limit;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListProductCatalog',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the product catalogs on the Business Manager platform of Meta.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ListProductCatalogRequest
 * @return ListProductCatalogResponse
 */
async function listProductCatalog(request: ListProductCatalogRequest): ListProductCatalogResponse {
  var runtime = new $RuntimeOptions{};
  return listProductCatalogWithOptions(request, runtime);
}

model ModifyChatappTemplateRequest {
  category?: string(name='Category', description='The category of the Viber message template. Valid values:

*   **text**: the template that contains only text
*   **image**: the template that contains only images
*   **text_image_button**: the template that contains text, images, and buttons
*   **text_button**: the template that contains text and buttons
*   **document**: the template that contains only documents
*   **video**: the template that contains only videos
*   **text_video**: the template that contains text and videos
*   **text_video_button**: the template that contains text, videos, and buttons
*   **text_image**: the template that contains text and images

> This parameter applies only to Viber message templates.', example='text'),
  components?: [ 
    {
      addSecretRecommendation?: boolean(name='AddSecretRecommendation', description='The note indicating that customers cannot share verification codes with others. The note is displayed in the message body. This parameter is valid if Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to BODY for a WhatsApp message template.', example='false'),
      buttons?: [ 
        {
          autofillText?: string(name='AutofillText', description='The text of the one-tap autofill button. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.', example='Autofill'),
          couponCode?: string(name='CouponCode', description='The coupon code. It can contain only letters and digits. You can set this parameter to a variable such as $(couponCode). Specify the value of couponCode when you send a message.', example='120293'),
          flowAction?: string(name='FlowAction', description='The Flow action.

Valid values:

*   DATA_EXCHANGE
*   NAVIGATE', example='NAVIGATE'),
          flowId?: string(name='FlowId', description='The Flow ID.', example='664597077870605'),
          isOptOut?: boolean(name='IsOptOut', description='The unsubscribe button. This parameter is valid if Category is set to MARKETING and the Type sub-parameter of the Buttons parameter is set to QUICK_REPLY for a WhatsApp message template. Marketing messages will not be sent to customers if you configure message sending in the Chat App Message Service console and the customers click this button.', example='false'),
          navigateScreen?: string(name='NavigateScreen', description='The first screen in the Flow. This parameter is required if FlowAction is set to NAVIGATE.', example='DETAILS'),
          packageName?: string(name='PackageName', description='The app package name that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.', example='com.demo', deprecated=true),
          phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='+8613888887889'),
          signatureHash?: string(name='SignatureHash', description='The app signing key hash that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.', example='29dkeke', deprecated=true),
          supportedApps?: [ 
            {
              packageName?: string(name='PackageName', description='The Whatsapp template is required when the Category is\\\\" Authorisation \\\\"and the Button Type is\\\\" ONE_TAP/ZERO-TAP\\\\", indicating the signature hash value of the Whatsapp call application.', example='com.example.myapplication'),
              signatureHash?: string(name='SignatureHash', description='The Whatsapp template is required when the Category is\\\\" Authorisation \\\\"and the Button Type is\\\\" ONE_TAP/ZERO-TAP\\\\", indicating the signature hash value of the Whatsapp call application.', example='fk39kd93ks9'),
            }
          ](name='SupportedApps', description='List of supported apps.'),
          text?: string(name='Text', description='The text of the button.', example='phone-button-text'),
          type?: string(name='Type', description='The button type. Valid values:

*   **PHONE_NUMBER**: phone call button
*   **URL**: URL button
*   **QUICK_REPLY**: quick reply button
*   **COPY_CODE**: copy code button
*   **ONE_TAP**: one-tap autofill button if Category is set to AUTHENTICATION

> 

*   If Category is set to AUTHENTICATION for a WhatsApp message template, you can add only one button to the WhatsApp message template and you must set the Type sub-parameter of the Buttons parameter to COPY_CODE or ONE_TAP. If Type is set to COPY_CODE, the Text sub-parameter of the Buttons parameter is required. If Type is set to ONE_TAP, the Text, SignatureHash, PackageName, and AutofillText sub-parameters of the Buttons parameter are required. The value of Text is displayed if the desired app is not installed on the device. The value of Text indicates that you must manually copy the verification code.

*   You can add only one button to a Viber message template, and you must set the Type sub-parameter of the Buttons parameter to URL.

This parameter is required.', example='PHONE_NUMBER'),
          url?: string(name='Url', description='The URL to which you are redirected when you click the URL button.', example='https://www.website.com/'),
          urlType?: string(name='UrlType', description='The URL type. Valid values:

*   **static**
*   **dynamic**', example='dynamic'),
        }
      ](name='Buttons', description='The buttons. Specify this parameter only if you set the Type sub-parameter of the Components parameter to **BUTTONS**.

>  ####

*   A marketing or utility WhatsApp message template can contain up to 10 buttons.

*   A WhatsApp message template can contain only one phone call button.

*   A WhatsApp message template can contain up to two URL buttons.

*   In a WhatsApp message template, a quick reply button cannot be used together with a phone call button or a URL button.'),
      caption?: string(name='Caption', description='The description of the media resource.

>  If the Type sub-parameter of the Components parameter is set to **HEADER** and the Format parameter is set to **IMAGE, DOCUMENT, or VIDEO**, you can specify this parameter.', example='This is a video'),
      cards?: [ 
        {
          cardComponents?: [ 
            {
              buttons?: [ 
                {
                  phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='+8613800'),
                  text?: string(name='Text', description='The text of the button.', example='Call me'),
                  type?: string(name='Type', description='The button type. Valid values:

*   **PHONE_NUMBER**: phone call button
*   **URL**: URL button
*   **QUICK_REPLY**: quick reply button

This parameter is required.', example='PHONE_NUMBER'),
                  url?: string(name='Url', description='The URL to which you are redirected when you click the URL button.', example='https://alibaba.com/xx'),
                  urlType?: string(name='UrlType', description='The URL type. Valid values:

*   **static**
*   **dynamic**', example='static'),
                }
              ](name='Buttons', description='The buttons. Specify this parameter only if you set the Type sub-parameter of the CardComponents parameter to BUTTONS. A carousel card can contain up to two buttons.'),
              format?: string(name='Format', description='The type of the media resource. This parameter is valid if the Type sub-parameter of the CardComponents parameter is set to HEADER. Valid values:

*   **IMAGE**
*   **VIDEO**', example='IMAGE'),
              text?: string(name='Text', description='The body content of the carousel card.', example='Who is the very powerful team'),
              type?: string(name='Type', description='The component type. Valid values:

*   **BODY**
*   **HEADER**
*   **BUTTONS**

This parameter is required.', example='BODY'),
              url?: string(name='Url', description='The URL of the media resource.', example='https://alibaba.com/img.png'),
            }
          ](name='CardComponents', description='The components of the carousel card.

This parameter is required.'),
        }
      ](name='Cards', description='The carousel cards of the carousel template.'),
      codeExpirationMinutes?: int32(name='CodeExpirationMinutes', description='The validity period of the verification code in the WhatsApp authentication template. Unit: minutes. This parameter is valid only when Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to FOOTER. The validity period of the verification code is displayed in the footer.', example='5'),
      duration?: int32(name='Duration', description='The length of the video in the Viber message template. Unit: seconds. Valid values: 0 to 600.', example='120'),
      fileName?: string(name='FileName', description='The name of the document.

>  If the Type sub-parameter of the Components parameter is set to **HEADER** and the Format parameter is set to **DOCUMENT**, you can specify this parameter.', example='video name'),
      fileType?: string(name='FileType', description='The type of the document attached in the Viber message template.', example='docx'),
      format?: string(name='Format', description='The type of the media resource. Valid values:

*   **TEXT**
*   **IMAGE**
*   **DOCUMENT**
*   **VIDEO**', example='TEXT'),
      hasExpiration?: boolean(name='HasExpiration', description='Specifies whether the coupon code has an expiration time. Specify this parameter if the Type sub-parameter of the Components parameter is set to LIMITED_TIME_OFFER.', example='true'),
      text?: string(name='Text', description='The text of the message that you want to send.

>  If Category is set to AUTHENTICATION, do not specify the Text sub-parameter of the Components parameter.', example='hello chatapp'),
      thumbUrl?: string(name='ThumbUrl', description='The thumbnail URL of the video in the Viber message template.', example='https://cdn.multiplymall.mobiapp.cloud/cloudcode/yc-165407506207478-165511576113195/20220905/ec5b9737-1507-4208-bb27-8da3958da961.jpg?x-oss-process=image/resize,w_100'),
      type?: string(name='Type', description='The component type. Valid values:

*   **BODY**
*   **HEADER**
*   **FOOTER**
*   **BUTTONS**
*   **CAROUSEL**
*   **LIMITED_TIME_OFFER**

> 

*   In a WhatsApp message template, a **Body** component cannot exceed 1,024 characters in length. A **HEADER** or **FOOTER** component cannot exceed 60 characters in length.

*   **FOOTER**, **CAROUSEL**, and **LIMITED_TIME_OFFER** components are not supported in Viber message templates.

*   In Viber message templates, media resources such as images, videos, and documents are placed in the **HEADER** component. If a Viber message contains text and an image, the image is placed below the text in the message received on a device.

This parameter is required.', example='BODY'),
      url?: string(name='Url', description='The URL of the media resource.', example='https://img.tukuppt.com/png_preview/00/10/24/1GygxVK3F4.jpg'),
    }
  ](name='Components', description='The components of the message template.

>  If Category is set to AUTHENTICATION, the Type sub-parameter of the Components parameter cannot be set to HEADER. If the Type sub-parameter is set to BODY or FOOTER, you do not need to set the Text sub-parameter of the Components parameter because the value is automatically generated.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

> CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='659216218162179', deprecated=true),
  example?: map[string]string(name='Example', description='The examples of variables that are used when you create the message template.'),
  isvCode?: string(name='IsvCode', description='The ISV verification code, which is used to verify whether the user is authorized by the ISV account.', example='ksiekdki39ksks93939'),
  language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).

This parameter is required.', example='en'),
  messageSendTtlSeconds?: int32(name='MessageSendTtlSeconds', description='Validity period of authentication template message sending in WhatsApp

>This attribute requires providing waba in advance to Alibaba operators to open the whitelist, otherwise it will result in template submission failure', example='120'),
  templateCode?: string(name='TemplateCode', description='The message template code.', example='8472929283883'),
  templateName?: string(name='TemplateName', description='Template name.', example='test_name'),
  templateType?: string(name='TemplateType', description='The type of the message template.

*   **WHATSAPP**
*   **VIBER**
*   LINE: the Line message template. This type of message template will be released later.', example='WHATSAPP'),
}

model ModifyChatappTemplateShrinkRequest {
  category?: string(name='Category', description='The category of the Viber message template. Valid values:

*   **text**: the template that contains only text
*   **image**: the template that contains only images
*   **text_image_button**: the template that contains text, images, and buttons
*   **text_button**: the template that contains text and buttons
*   **document**: the template that contains only documents
*   **video**: the template that contains only videos
*   **text_video**: the template that contains text and videos
*   **text_video_button**: the template that contains text, videos, and buttons
*   **text_image**: the template that contains text and images

> This parameter applies only to Viber message templates.', example='text'),
  componentsShrink?: string(name='Components', description='The components of the message template.

>  If Category is set to AUTHENTICATION, the Type sub-parameter of the Components parameter cannot be set to HEADER. If the Type sub-parameter is set to BODY or FOOTER, you do not need to set the Text sub-parameter of the Components parameter because the value is automatically generated.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the ISV account.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

> CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='659216218162179', deprecated=true),
  exampleShrink?: string(name='Example', description='The examples of variables that are used when you create the message template.'),
  isvCode?: string(name='IsvCode', description='The ISV verification code, which is used to verify whether the user is authorized by the ISV account.', example='ksiekdki39ksks93939'),
  language?: string(name='Language', description='The language that is used in the message template. For more information, see [Language codes](https://help.aliyun.com/document_detail/463420.html).

This parameter is required.', example='en'),
  messageSendTtlSeconds?: int32(name='MessageSendTtlSeconds', description='Validity period of authentication template message sending in WhatsApp

>This attribute requires providing waba in advance to Alibaba operators to open the whitelist, otherwise it will result in template submission failure', example='120'),
  templateCode?: string(name='TemplateCode', description='The message template code.', example='8472929283883'),
  templateName?: string(name='TemplateName', description='Template name.', example='test_name'),
  templateType?: string(name='TemplateType', description='The type of the message template.

*   **WHATSAPP**
*   **VIBER**
*   LINE: the Line message template. This type of message template will be released later.', example='WHATSAPP'),
}

model ModifyChatappTemplateResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    templateCode?: string(name='TemplateCode', description='The code of the message template.', example='8472929283883'),
    templateName?: string(name='TemplateName', description='The name of the message template.', example='hello_whatsapp'),
  }(name='Data', description='The data returned.'),
  message?: string(name='Message', description='The error message returned.', example='NONE'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model ModifyChatappTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyChatappTemplateResponseBody(name='body'),
}

/**
 * @summary The code of the message template.
 *
 * @description The name of the message template.
 *
 * @param tmpReq ModifyChatappTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyChatappTemplateResponse
 */
async function modifyChatappTemplateWithOptions(tmpReq: ModifyChatappTemplateRequest, runtime: $RuntimeOptions): ModifyChatappTemplateResponse {
  tmpReq.validate();
  var request = new ModifyChatappTemplateShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.components)) {
    request.componentsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.components, 'Components', 'json');
  }
  if (!$isNull(tmpReq.example)) {
    request.exampleShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.example, 'Example', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.category)) {
    body['Category'] = request.category;
  }
  if (!$isNull(request.componentsShrink)) {
    body['Components'] = request.componentsShrink;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.custWabaId)) {
    body['CustWabaId'] = request.custWabaId;
  }
  if (!$isNull(request.exampleShrink)) {
    body['Example'] = request.exampleShrink;
  }
  if (!$isNull(request.isvCode)) {
    body['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.language)) {
    body['Language'] = request.language;
  }
  if (!$isNull(request.messageSendTtlSeconds)) {
    body['MessageSendTtlSeconds'] = request.messageSendTtlSeconds;
  }
  if (!$isNull(request.templateCode)) {
    body['TemplateCode'] = request.templateCode;
  }
  if (!$isNull(request.templateName)) {
    body['TemplateName'] = request.templateName;
  }
  if (!$isNull(request.templateType)) {
    body['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyChatappTemplate',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The code of the message template.
 *
 * @description The name of the message template.
 *
 * @param request ModifyChatappTemplateRequest
 * @return ModifyChatappTemplateResponse
 */
async function modifyChatappTemplate(request: ModifyChatappTemplateRequest): ModifyChatappTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return modifyChatappTemplateWithOptions(request, runtime);
}

model ModifyFlowRequest {
  categories?: [ string ](name='Categories', description='The information about the categories of the Flow.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='9493884'),
  flowId?: string(name='FlowId', description='The Flow ID.', example='2938838'),
  flowName?: string(name='FlowName', description='The name of the Flow.

This parameter is required.', example='flow_001'),
}

model ModifyFlowShrinkRequest {
  categoriesShrink?: string(name='Categories', description='The information about the categories of the Flow.

This parameter is required.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='9493884'),
  flowId?: string(name='FlowId', description='The Flow ID.', example='2938838'),
  flowName?: string(name='FlowName', description='The name of the Flow.

This parameter is required.', example='flow_001'),
}

model ModifyFlowResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  data?: {
    categories?: [ string ](name='Categories', description='The categories of the Flow.'),
    flowId?: string(name='FlowId', description='The Flow ID.', example='3939399****'),
    flowName?: string(name='FlowName', description='The Flow name.', example='flow-00203'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='1612C226-E271-4CFE-9F18-4066D******'),
}

model ModifyFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyFlowResponseBody(name='body'),
}

/**
 * @summary Modifies the basic information about a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq ModifyFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyFlowResponse
 */
async function modifyFlowWithOptions(tmpReq: ModifyFlowRequest, runtime: $RuntimeOptions): ModifyFlowResponse {
  tmpReq.validate();
  var request = new ModifyFlowShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.categories)) {
    request.categoriesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.categories, 'Categories', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.categoriesShrink)) {
    body['Categories'] = request.categoriesShrink;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  if (!$isNull(request.flowName)) {
    body['FlowName'] = request.flowName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the basic information about a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request ModifyFlowRequest
 * @return ModifyFlowResponse
 */
async function modifyFlow(request: ModifyFlowRequest): ModifyFlowResponse {
  var runtime = new $RuntimeOptions{};
  return modifyFlowWithOptions(request, runtime);
}

model ModifyPhoneBusinessProfileRequest {
  about?: string(name='About', description='The business information.', example='business profile'),
  address?: string(name='Address', description='The address.', example='The phone number.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849****'),
  description?: string(name='Description', description='The description of the phone number.', example='test'),
  email?: string(name='Email', description='The email address.', example='aa@aliyun.com'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The mobile phone number.

This parameter is required.', example='8613800001234'),
  profilePictureUrl?: string(name='ProfilePictureUrl', description='The URL of the profile picture.', example='http://a.img'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  vertical?: string(name='Vertical', description='The industry.

>  Valid values: OTHER, AUTO, BEAUTY, APPAREL, EDU, ENTERTAIN, EVENT_PLAN, FINANCE, GROCERY, GOVT, HOTEL, HEALTH, NONPROFIT, PROF_SERVICES, RETAIL, TRAVEL, and RESTAURANT.', example='OTHER'),
  websites?: [ string ](name='Websites', description='The URLs of the websites.'),
}

model ModifyPhoneBusinessProfileShrinkRequest {
  about?: string(name='About', description='The business information.', example='business profile'),
  address?: string(name='Address', description='The address.', example='The phone number.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849****'),
  description?: string(name='Description', description='The description of the phone number.', example='test'),
  email?: string(name='Email', description='The email address.', example='aa@aliyun.com'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The mobile phone number.

This parameter is required.', example='8613800001234'),
  profilePictureUrl?: string(name='ProfilePictureUrl', description='The URL of the profile picture.', example='http://a.img'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  vertical?: string(name='Vertical', description='The industry.

>  Valid values: OTHER, AUTO, BEAUTY, APPAREL, EDU, ENTERTAIN, EVENT_PLAN, FINANCE, GROCERY, GOVT, HOTEL, HEALTH, NONPROFIT, PROF_SERVICES, RETAIL, TRAVEL, and RESTAURANT.', example='OTHER'),
  websitesShrink?: string(name='Websites', description='The URLs of the websites.'),
}

model ModifyPhoneBusinessProfileResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The URL of the website.', example='OK'),
  message?: string(name='Message', description='The ID of the request.', example='SUCCESS'),
  requestId?: string(name='RequestId', description='The websites.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model ModifyPhoneBusinessProfileResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPhoneBusinessProfileResponseBody(name='body'),
}

/**
 * @summary The ID of the request.
 *
 * @description ModifyPhoneBusinessProfile
 *
 * @param tmpReq ModifyPhoneBusinessProfileRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPhoneBusinessProfileResponse
 */
async function modifyPhoneBusinessProfileWithOptions(tmpReq: ModifyPhoneBusinessProfileRequest, runtime: $RuntimeOptions): ModifyPhoneBusinessProfileResponse {
  tmpReq.validate();
  var request = new ModifyPhoneBusinessProfileShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.websites)) {
    request.websitesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.websites, 'Websites', 'json');
  }
  var query = {};
  if (!$isNull(request.about)) {
    query['About'] = request.about;
  }
  if (!$isNull(request.address)) {
    query['Address'] = request.address;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.email)) {
    query['Email'] = request.email;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.profilePictureUrl)) {
    query['ProfilePictureUrl'] = request.profilePictureUrl;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.vertical)) {
    query['Vertical'] = request.vertical;
  }
  if (!$isNull(request.websitesShrink)) {
    query['Websites'] = request.websitesShrink;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyPhoneBusinessProfile',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the request.
 *
 * @description ModifyPhoneBusinessProfile
 *
 * @param request ModifyPhoneBusinessProfileRequest
 * @return ModifyPhoneBusinessProfileResponse
 */
async function modifyPhoneBusinessProfile(request: ModifyPhoneBusinessProfileRequest): ModifyPhoneBusinessProfileResponse {
  var runtime = new $RuntimeOptions{};
  return modifyPhoneBusinessProfileWithOptions(request, runtime);
}

model PublishFlowRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.', example='28251486512358****'),
  flowId?: string(name='FlowId', description='The Flow ID.

This parameter is required.', example='flow_001'),
}

model PublishFlowResponseBody = {
  code?: string(name='Code', description='If OK is returned, the request was successful.', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model PublishFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PublishFlowResponseBody(name='body'),
}

/**
 * @summary Publishes a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request PublishFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PublishFlowResponse
 */
async function publishFlowWithOptions(request: PublishFlowRequest, runtime: $RuntimeOptions): PublishFlowResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'PublishFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Publishes a Flow.
 *
 * @description You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request PublishFlowRequest
 * @return PublishFlowResponse
 */
async function publishFlow(request: PublishFlowRequest): PublishFlowResponse {
  var runtime = new $RuntimeOptions{};
  return publishFlowWithOptions(request, runtime);
}

model QueryChatappBindWabaRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user under the ISV account.', example='293483938849493'),
  isvCode?: string(name='IsvCode', description='The ISV verification code, which is used to verify whether the user is authorized by the ISV account.', example='aksik93kdkkxmwol93939'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryChatappBindWabaResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    accountReviewStatus?: string(name='AccountReviewStatus', description='The review state of the WhatsApp Business account (WABA).

>  Valid values:

*   PENDING: The WABA is to be reviewed.

*   APPROVED: The WABA was approved.

*   REJECTED: The WABA was rejected.

*   DISABLED: The WABA was forbidden.', example='APPROVED'),
    authInternationalRateEligibility?: map[string]any(name='AuthInternationalRateEligibility', description='WABA related information.'),
    businessId?: string(name='BusinessId', description='The ID of the business platform.', example='19293988***'),
    businessName?: string(name='BusinessName', description='The name of the business platform.', example='Alibaba'),
    currency?: string(name='Currency', description='The currency.', example='USD'),
    id?: string(name='Id', description='The ID of the WhatsApp Business account.', example='20393988393993***'),
    messageTemplateNamespace?: string(name='MessageTemplateNamespace', description='The namespace of the message template.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
    name?: string(name='Name', description='The name of the WhatsApp Business account.', example='Alibaba'),
    primaryBusinessLocation?: string(name='PrimaryBusinessLocation', description='The start time when the authentication-international rate applies.', example='"start_time":1721952000'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message returned.', example='SUCCESS'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model QueryChatappBindWabaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryChatappBindWabaResponseBody(name='body'),
}

/**
 * @summary Query the WhatsApp Business account you associate with ChatApp.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryChatappBindWabaRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryChatappBindWabaResponse
 */
async function queryChatappBindWabaWithOptions(request: QueryChatappBindWabaRequest, runtime: $RuntimeOptions): QueryChatappBindWabaResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'QueryChatappBindWaba',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Query the WhatsApp Business account you associate with ChatApp.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryChatappBindWabaRequest
 * @return QueryChatappBindWabaResponse
 */
async function queryChatappBindWaba(request: QueryChatappBindWabaRequest): QueryChatappBindWabaResponse {
  var runtime = new $RuntimeOptions{};
  return queryChatappBindWabaWithOptions(request, runtime);
}

model QueryChatappPhoneNumbersRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the ISV account.', example='293483938849493'),
  isvCode?: string(name='IsvCode', description='The independent software vendor (ISV) verification code, which is used to verify whether the RAM user is authorized by the ISV account.', example='aksik93kdkkxmwol93939'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  status?: string(name='Status', description='The state of the phone number.', example='VERIFIED'),
}

model QueryChatappPhoneNumbersResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The message returned.', example='SUCCESS'),
  phoneNumbers?: [ 
    {
      codeVerificationStatus?: string(name='CodeVerificationStatus', description='The verification status of the phone number.', example='VERIFIED'),
      isOfficial?: string(name='IsOfficial', example='N'),
      messagingLimitTier?: string(name='MessagingLimitTier', description='The number of phone numbers to which messages can be sent in a day.

Valid values:

*   TIER_100K: 100,000
*   TIER_UNLIMITED: unlimited
*   TIER_250: 250
*   TIER_1K: 1,000
*   TIER_50: 50
*   TIER_10K: 10,000', example='TIER_10'),
      nameStatus?: string(name='NameStatus', description='The status of the business name.', example='Approval'),
      newNameStatus?: string(name='NewNameStatus', description='The review status of the new business name.', example='Approval'),
      phoneNumber?: string(name='PhoneNumber', description='The phone number.', example='8613800000'),
      qualityRating?: string(name='QualityRating', description='The quality rating of the phone number.

Valid values:

*   RED
*   YELLOW
*   UNKNOWN
*   GREEN', example='GREEN'),
      status?: string(name='Status', description='The state of the phone number.

Valid values:

*   MIGRATED
*   FLAGGED
*   DISCONNECTED
*   UNVERIFIED
*   BANNED
*   RATE_LIMITED
*   PENDING
*   CONNECTED
*   UNKNOWN
*   DELETED
*   RESTRICTED', example='CONNECTED'),
      statusCallbackUrl?: string(name='StatusCallbackUrl', description='The callback URL to which status reports are sent by using HTTP callbacks.', example='https://ali.com/status'),
      statusQueue?: string(name='StatusQueue', description='The status report queue.', example='Alicom-Queue-****-ChatAppStatus'),
      upCallbackUrl?: string(name='UpCallbackUrl', description='The callback URL to which MO messages are sent by using HTTP callbacks.', example='https://ali.com/inbound'),
      upQueue?: string(name='UpQueue', description='The mobile originated (MO) message notification queue.', example='Alicom-Queue-****-ChatAppInbound'),
      verifiedName?: string(name='VerifiedName', description='The name of the company with which the phone number is associated.', example='Alibaba'),
    }
  ](name='PhoneNumbers', description='The phone numbers.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', example='true'),
}

model QueryChatappPhoneNumbersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryChatappPhoneNumbersResponseBody(name='body'),
}

/**
 * @summary Queries phone numbers that receive messages and statuses of these numbers under a specified user.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryChatappPhoneNumbersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryChatappPhoneNumbersResponse
 */
async function queryChatappPhoneNumbersWithOptions(request: QueryChatappPhoneNumbersRequest, runtime: $RuntimeOptions): QueryChatappPhoneNumbersResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.isvCode)) {
    query['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'QueryChatappPhoneNumbers',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries phone numbers that receive messages and statuses of these numbers under a specified user.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryChatappPhoneNumbersRequest
 * @return QueryChatappPhoneNumbersResponse
 */
async function queryChatappPhoneNumbers(request: QueryChatappPhoneNumbersRequest): QueryChatappPhoneNumbersResponse {
  var runtime = new $RuntimeOptions{};
  return queryChatappPhoneNumbersWithOptions(request, runtime);
}

model QueryPhoneBusinessProfileRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.

This parameter is required.', example='2934839388494***'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='8613800001234'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model QueryPhoneBusinessProfileResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    about?: string(name='About', description='Regarding.', example='business profile'),
    address?: string(name='Address', description='The address.', example='Changsha'),
    description?: string(name='Description', description='The description.', example='Description'),
    email?: string(name='Email', description='The email address.', example='aa@aliyun.com'),
    profilePictureUrl?: string(name='ProfilePictureUrl', description='The profile picture.', example='https://....img'),
    vertical?: string(name='Vertical', description='The industry.', example='Retail'),
    websites?: [ string ](name='Websites', description='The website.'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='The error message returned.', example='None'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model QueryPhoneBusinessProfileResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryPhoneBusinessProfileResponseBody(name='body'),
}

/**
 * @summary Queries the business information of the account to which a specified phone number is bound.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryPhoneBusinessProfileRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryPhoneBusinessProfileResponse
 */
async function queryPhoneBusinessProfileWithOptions(request: QueryPhoneBusinessProfileRequest, runtime: $RuntimeOptions): QueryPhoneBusinessProfileResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'QueryPhoneBusinessProfile',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the business information of the account to which a specified phone number is bound.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryPhoneBusinessProfileRequest
 * @return QueryPhoneBusinessProfileResponse
 */
async function queryPhoneBusinessProfile(request: QueryPhoneBusinessProfileRequest): QueryPhoneBusinessProfileResponse {
  var runtime = new $RuntimeOptions{};
  return queryPhoneBusinessProfileWithOptions(request, runtime);
}

model QueryWabaBusinessInfoRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493****'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  wabaId?: string(name='WabaId', description='The ID of the WhatsApp Business Account (WABA).

This parameter is required.', example='293848822333'),
}

model QueryWabaBusinessInfoResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  data?: {
    businessId?: string(name='BusinessId', description='The Business Manager ID.', example='192882828733'),
    businessName?: string(name='BusinessName', description='The Business Manager name.', example='Alibaba'),
    verificationStatus?: string(name='VerificationStatus', description='The verification status.', example='verified'),
    vertical?: string(name='Vertical', description='The industry.', example='Retail', deprecated=true),
  }(name='Data', description='The business information about the WABA.'),
  message?: string(name='Message', description='The error message returned.', example='None.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='false'),
}

model QueryWabaBusinessInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryWabaBusinessInfoResponseBody(name='body'),
}

/**
 * @summary Queries the business information about the WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryWabaBusinessInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryWabaBusinessInfoResponse
 */
async function queryWabaBusinessInfoWithOptions(request: QueryWabaBusinessInfoRequest, runtime: $RuntimeOptions): QueryWabaBusinessInfoResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.wabaId)) {
    query['WabaId'] = request.wabaId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'QueryWabaBusinessInfo',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the business information about the WhatsApp Business account (WABA).
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request QueryWabaBusinessInfoRequest
 * @return QueryWabaBusinessInfoResponse
 */
async function queryWabaBusinessInfo(request: QueryWabaBusinessInfoRequest): QueryWabaBusinessInfoResponse {
  var runtime = new $RuntimeOptions{};
  return queryWabaBusinessInfoWithOptions(request, runtime);
}

model SendChatappMassMessageRequest {
  channelType?: string(name='ChannelType', description='The type of the channel. Valid values:

*   **whatsapp**
*   **viber**
*   **line** (under development)

This parameter is required.', example='whatsapp'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business Account (WABA) ID of the RAM user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  fallBackContent?: string(name='FallBackContent', description='The content of the fallback message.', example='Fallback message'),
  fallBackDuration?: int32(name='FallBackDuration', description='Specifies the period of time after which the fallback message is sent if the message receipt that indicates the message is delivered to clients is not received. If this parameter is left empty, the fallback message is sent only when the message fails to be sent or the message receipt that indicates the message is not delivered to clients is received. Unit: seconds. Valid values: 60 to 43200.', example='120'),
  fallBackId?: string(name='FallBackId', description='The ID of the fallback policy.', example='S00001'),
  fallBackRule?: string(name='FallBackRule', description='The fallback rule. Valid values:

*   **undelivered**: A fallback is triggered if the message is not delivered to clients. When the message is being sent, the template parameters are verified. If the parameters fail to pass the verification, the message fails to be sent. Whether the template and phone number are prohibited is not verified. By default, this value is used when FallBackRule is left empty.
*   **sentFailed**: A fallback is triggered even if the template parameters including variables fail to pass the verification. If the channelType, type, messageType, to, and from parameters fail to pass the verification, a fallback is not triggered.', example='undelivered'),
  from?: string(name='From', description='The mobile phone number of the message sender.

This parameter is required.', example='861387777****'),
  isvCode?: string(name='IsvCode', description='The ISV verification code. This parameter is used to verify whether the RAM user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  label?: string(name='Label', description='The type of the Viber message. Valid values:

*   **promotion**
*   **transaction**', example='promotion'),
  language?: string(name='Language', description='The language. For more information about language codes, see [Language codes](https://help.aliyun.com/document_detail/463420.html).

This parameter is required.', example='en'),
  senderList?: [ 
    {
      flowAction?: {
        flowActionData?: map[string]any(name='FlowActionData', description='The default parameter of the Flow.'),
        flowToken?: string(name='FlowToken', description='The information about the Flow token.', example='kde****'),
      }(name='FlowAction', description='The Flow action.'),
      payload?: [ string ](name='Payload', description='The payload of the button.'),
      productAction?: {
        sections?: [ 
          {
            productItems?: [ 
              {
                productRetailerId?: string(name='ProductRetailerId', description='The retailer ID of the product.', example='ksi399d8'),
              }
            ](name='ProductItems', description='The products.'),
            title?: string(name='Title', description='The name of the category.', example='abcd'),
          }
        ](name='Sections', description='The products. Up to 30 products and 10 categories can be added.'),
        thumbnailProductRetailerId?: string(name='ThumbnailProductRetailerId', description='The retailer ID of the product.', example='skkks999393'),
      }(name='ProductAction', description='The information about the product.'),
      templateParams?: map[string]string(name='TemplateParams', description='The parameters of the template.'),
      to?: string(name='To', description='The mobile phone number of the message receiver.

This parameter is required.', example='861388988****'),
    }
  ](name='SenderList', description='The mobile phone numbers of the message receivers.

This parameter is required.'),
  tag?: string(name='Tag', description='The tag information when the ChannelType parameter is set to viber.', example='tag'),
  taskId?: string(name='TaskId', description='The task ID.', example='100000001'),
  templateCode?: string(name='TemplateCode', description='The template code.', example='744c4b5c79c9432497a075bdfca36bf5'),
  templateName?: string(name='TemplateName', description='The name of the message template.', example='test_name'),
  ttl?: long(name='Ttl', description='The timeout period for sending messages when the ChannelType parameter is set to viber. Valid values: 30 to 1209600. Unit: seconds.', example='50'),
}

model SendChatappMassMessageShrinkRequest {
  channelType?: string(name='ChannelType', description='The type of the channel. Valid values:

*   **whatsapp**
*   **viber**
*   **line** (under development)

This parameter is required.', example='whatsapp'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business Account (WABA) ID of the RAM user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  fallBackContent?: string(name='FallBackContent', description='The content of the fallback message.', example='Fallback message'),
  fallBackDuration?: int32(name='FallBackDuration', description='Specifies the period of time after which the fallback message is sent if the message receipt that indicates the message is delivered to clients is not received. If this parameter is left empty, the fallback message is sent only when the message fails to be sent or the message receipt that indicates the message is not delivered to clients is received. Unit: seconds. Valid values: 60 to 43200.', example='120'),
  fallBackId?: string(name='FallBackId', description='The ID of the fallback policy.', example='S00001'),
  fallBackRule?: string(name='FallBackRule', description='The fallback rule. Valid values:

*   **undelivered**: A fallback is triggered if the message is not delivered to clients. When the message is being sent, the template parameters are verified. If the parameters fail to pass the verification, the message fails to be sent. Whether the template and phone number are prohibited is not verified. By default, this value is used when FallBackRule is left empty.
*   **sentFailed**: A fallback is triggered even if the template parameters including variables fail to pass the verification. If the channelType, type, messageType, to, and from parameters fail to pass the verification, a fallback is not triggered.', example='undelivered'),
  from?: string(name='From', description='The mobile phone number of the message sender.

This parameter is required.', example='861387777****'),
  isvCode?: string(name='IsvCode', description='The ISV verification code. This parameter is used to verify whether the RAM user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  label?: string(name='Label', description='The type of the Viber message. Valid values:

*   **promotion**
*   **transaction**', example='promotion'),
  language?: string(name='Language', description='The language. For more information about language codes, see [Language codes](https://help.aliyun.com/document_detail/463420.html).

This parameter is required.', example='en'),
  senderListShrink?: string(name='SenderList', description='The mobile phone numbers of the message receivers.

This parameter is required.'),
  tag?: string(name='Tag', description='The tag information when the ChannelType parameter is set to viber.', example='tag'),
  taskId?: string(name='TaskId', description='The task ID.', example='100000001'),
  templateCode?: string(name='TemplateCode', description='The template code.', example='744c4b5c79c9432497a075bdfca36bf5'),
  templateName?: string(name='TemplateName', description='The name of the message template.', example='test_name'),
  ttl?: long(name='Ttl', description='The timeout period for sending messages when the ChannelType parameter is set to viber. Valid values: 30 to 1209600. Unit: seconds.', example='50'),
}

model SendChatappMassMessageResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  groupMessageId?: string(name='GroupMessageId', description='The ID of the message group.', example='890000010002****'),
  message?: string(name='Message', description='The error message returned.', example='User not authorized to operate on the specified resource.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model SendChatappMassMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendChatappMassMessageResponseBody(name='body'),
}

/**
 * @summary Sends a message to multiple phone numbers by using ChatAPP at a time.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * You can send messages to up to 1,000 phone numbers in a single request.
 *
 * @param tmpReq SendChatappMassMessageRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendChatappMassMessageResponse
 */
async function sendChatappMassMessageWithOptions(tmpReq: SendChatappMassMessageRequest, runtime: $RuntimeOptions): SendChatappMassMessageResponse {
  tmpReq.validate();
  var request = new SendChatappMassMessageShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.senderList)) {
    request.senderListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.senderList, 'SenderList', 'json');
  }
  var body : map[string]any = {};
  if (!$isNull(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.custWabaId)) {
    body['CustWabaId'] = request.custWabaId;
  }
  if (!$isNull(request.fallBackContent)) {
    body['FallBackContent'] = request.fallBackContent;
  }
  if (!$isNull(request.fallBackDuration)) {
    body['FallBackDuration'] = request.fallBackDuration;
  }
  if (!$isNull(request.fallBackId)) {
    body['FallBackId'] = request.fallBackId;
  }
  if (!$isNull(request.fallBackRule)) {
    body['FallBackRule'] = request.fallBackRule;
  }
  if (!$isNull(request.from)) {
    body['From'] = request.from;
  }
  if (!$isNull(request.isvCode)) {
    body['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.label)) {
    body['Label'] = request.label;
  }
  if (!$isNull(request.language)) {
    body['Language'] = request.language;
  }
  if (!$isNull(request.senderListShrink)) {
    body['SenderList'] = request.senderListShrink;
  }
  if (!$isNull(request.tag)) {
    body['Tag'] = request.tag;
  }
  if (!$isNull(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  if (!$isNull(request.templateCode)) {
    body['TemplateCode'] = request.templateCode;
  }
  if (!$isNull(request.templateName)) {
    body['TemplateName'] = request.templateName;
  }
  if (!$isNull(request.ttl)) {
    body['Ttl'] = request.ttl;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'SendChatappMassMessage',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Sends a message to multiple phone numbers by using ChatAPP at a time.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * You can send messages to up to 1,000 phone numbers in a single request.
 *
 * @param request SendChatappMassMessageRequest
 * @return SendChatappMassMessageResponse
 */
async function sendChatappMassMessage(request: SendChatappMassMessageRequest): SendChatappMassMessageResponse {
  var runtime = new $RuntimeOptions{};
  return sendChatappMassMessageWithOptions(request, runtime);
}

model SendChatappMessageRequest {
  channelType?: string(name='ChannelType', description='The channel type. Valid values:

*   **whatsapp**
*   **viber**
*   **line** (under development)

This parameter is required.', example='whatsapp'),
  content?: string(name='Content', description='The message content.

**Notes on WhatsApp messages:**

*   If you set **messageType** to **text**, you must specify **text** and must not specify **Caption**.
*   If you set **messageType** to **image**, you must specify **Link**.
*   If you set **messageType** to **video**, you must specify **Link**.
*   If you set **messageType** to **audio**, **Link** is required and **Caption** is invalid.
*   If you set **messageType** to **document**, **Link** and **FileName** are required and **Caption** is invalid.
*   If you set **messageType** to **interactive**, you must specify **type** and **action**.
*   If you set **messageType** to **contacts**, you must specify **name**.
*   If you set **messageType** to **location**, you must specify **longitude** and **latitude**.
*   If you set **messageType** to **sticker**, you must specify **Link**, and **Caption** and **FileName** are invalid.
*   If you set **messageType** to **reaction**, you must specify **messageId** and **emoji**.

**Notes on Viber messages:**

*   If you set **messageType** to **text**, you must specify **text**.
*   If you set **messageType** to **image**, you must specify **link**.
*   If you set **messageType** to **video**, you must specify **link**, **thumbnail**, **fileSize**, and **duration**.
*   If you set **messageType** to **document**, you must specify **link**, **fileName**, and **fileType**.
*   If you set **messageType** to **text_button**, you must specify **text**, **caption**, and **action**.
*   If you set **messageType** to **text_image_button**, you must specify **text**, **link**, **caption**, and **action**.
*   If you set **messageType** to **text_video**, you must specify **text**, **link**, **thumbnail**, **fileSize**, and **duration**.
*   If you set **messageType** to **text_video_button**, you must specify **text**, **link**, **thumbnail**, **fileSize**, **duration**, and **caption**. In addition, you must not specify **action**.', example='{\\\\"text\\\\": \\\\"hello whatsapp\\\\", \\\\"link\\\\": \\\\"\\\\", \\\\"caption\\\\": \\\\"\\\\", \\\\"fileName\\\\": \\\\"\\\\" }'),
  contextMessageId?: string(name='ContextMessageId', description='The ID of the reply message.', example='61851ccb2f1365b16aee****'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business Account (WABA) ID of the RAM user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  fallBackContent?: string(name='FallBackContent', description='The content of the fallback message.', example='This is a fallback message.'),
  fallBackDuration?: int32(name='FallBackDuration', description='Specifies the period of time after which the fallback message is sent if the message receipt that indicates the message is delivered to clients is not received. If this parameter is left empty, the fallback message is sent only when the **message fails to be sent** or **the message receipt that indicates the message is not delivered to clients** is received. Unit: seconds. Valid values: 60 to 43200.', example='120'),
  fallBackId?: string(name='FallBackId', description='The ID of the fallback policy. You can create a fallback policy and view the information in the Chat App Message Service console.', example='S_000001'),
  fallBackRule?: string(name='FallBackRule', description='The fallback rule. Valid values:

*   **undelivered**: A fallback is triggered if the message is not delivered to clients. When the message is being sent, the template parameters are verified. If the parameters fail to pass the verification, the message fails to be sent. Whether the template and phone number are prohibited is not verified. By default, this value is used when FallBackRule is left empty.
*   **sentFailed**: A fallback is triggered even if the template parameters including variables fail to pass the verification. If the channelType, type, messageType, to, and from parameters fail to pass the verification, a fallback is not triggered.', example='undelivered'),
  flowAction?: {
    flowActionData?: map[string]any(name='FlowActionData', description='The default parameter of the Flow.'),
    flowToken?: string(name='FlowToken', description='The Flow token.', example='1122***'),
  }(name='FlowAction', description='The Flow action.'),
  from?: string(name='From', description='The mobile phone number of the message sender.

>  You can specify a mobile phone number that is registered for a WhatsApp account and is approved in the Chat App Message Service console.

This parameter is required.', example='1360000****'),
  isvCode?: string(name='IsvCode', description='The ISV verification code. This parameter is used to verify whether the RAM user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  label?: string(name='Label', description='The type of the Viber message. This parameter is required if ChannelType is set to viber. Valid values:

*   **promotion**
*   **transaction**', example='promotion'),
  language?: string(name='Language', description='The language that is used in the message template. This parameter is required only if you set the Type parameter to **template**. For more information about language codes, see [Language codes](https://help.aliyun.com/document_detail/463420.html).', example='en'),
  messageType?: string(name='MessageType', description='The specific type of the message. This parameter is required only if you set the Type parameter to **message**.

**Valid values of MessageType when you set the ChannelType parameter to whatsapp:**

*   **text**: a text message.
*   **image**: an image message.
*   **video**: a video message.
*   **audio**: an audio message.
*   **document**: a document message.
*   **interactive**: an interactive message.
*   **contacts**: a contact message.
*   **location**: a location message.
*   **sticker**: a sticker message.
*   **reaction**: a reaction message.

**Valid values of MessageType when you set the ChannelType parameter to viber:**

*   **text**: a text message.
*   **image**: an image message.
*   **video**: a video message.
*   **document**: a document message.
*   **text_button**: a message that contains the text and button media objects.
*   **text_image_button**: a message that contains multiple media objects, including the text, image, and button.
*   **text_video**: a message that contains the text and video media objects.
*   **text_video_button**: a message that contains multiple media objects, including text, video, and button.
*   **text_image**: a message that contains the text and image media objects.

> For more information, see [Parameters of a message template](https://help.aliyun.com/document_detail/454530.html).', example='text'),
  payload?: [ string ](name='Payload', description='The payload of the button.', example='payloadtext1,payloadtext2,payloadtext3'),
  productAction?: {
    sections?: [ 
      {
        productItems?: [ 
          {
            productRetailerId?: string(name='ProductRetailerId', description='The retailer ID of the product.', example='9I39E9E'),
          }
        ](name='ProductItems', description='The products.'),
        title?: string(name='Title', description='The name of the category.', example='Test'),
      }
    ](name='Sections', description='The products. Up to 30 products and 10 categories can be added.'),
    thumbnailProductRetailerId?: string(name='ThumbnailProductRetailerId', description='The retailer ID of the product.', example='S238SK'),
  }(name='ProductAction', description='The information about the products included in the WhatsApp catalog message or multi-product message (MPM).'),
  tag?: string(name='Tag', description='The tag information of the Viber message.', example='tag'),
  taskId?: string(name='TaskId', description='The task ID.', example='100000001'),
  templateCode?: string(name='TemplateCode', description='The code of the message template. This parameter is required only if you set the Type parameter to **template**.', example='744c4b5c79c9432497a075bdfca3****'),
  templateName?: string(name='TemplateName', description='The name of the message template.', example='test_name'),
  templateParams?: map[string]string(name='TemplateParams', description='The variables of the message template.'),
  to?: string(name='To', description='The mobile phone number of the message receiver.

This parameter is required.', example='1390000****'),
  trackingData?: string(name='TrackingData', description='The tracking data of the Viber message.', example='tracking_id:123456'),
  ttl?: int32(name='Ttl', description='The timeout period for sending the Viber message. Valid values: 30 to 1209600. Unit: seconds.', example='50'),
  type?: string(name='Type', description='The message type. Valid values:

*   **template**: the template message. A template message is sent based on a template that is created and approved in the Chat App Message Service console. You can send template messages based on your business requirements.
*   **message**: the custom message. You can send a custom WhatsApp message to a user only within 24 hours after you receive the last message from the user. This limit does not apply to custom Viber messages.

This parameter is required.', example='template'),
}

model SendChatappMessageShrinkRequest {
  channelType?: string(name='ChannelType', description='The channel type. Valid values:

*   **whatsapp**
*   **viber**
*   **line** (under development)

This parameter is required.', example='whatsapp'),
  content?: string(name='Content', description='The message content.

**Notes on WhatsApp messages:**

*   If you set **messageType** to **text**, you must specify **text** and must not specify **Caption**.
*   If you set **messageType** to **image**, you must specify **Link**.
*   If you set **messageType** to **video**, you must specify **Link**.
*   If you set **messageType** to **audio**, **Link** is required and **Caption** is invalid.
*   If you set **messageType** to **document**, **Link** and **FileName** are required and **Caption** is invalid.
*   If you set **messageType** to **interactive**, you must specify **type** and **action**.
*   If you set **messageType** to **contacts**, you must specify **name**.
*   If you set **messageType** to **location**, you must specify **longitude** and **latitude**.
*   If you set **messageType** to **sticker**, you must specify **Link**, and **Caption** and **FileName** are invalid.
*   If you set **messageType** to **reaction**, you must specify **messageId** and **emoji**.

**Notes on Viber messages:**

*   If you set **messageType** to **text**, you must specify **text**.
*   If you set **messageType** to **image**, you must specify **link**.
*   If you set **messageType** to **video**, you must specify **link**, **thumbnail**, **fileSize**, and **duration**.
*   If you set **messageType** to **document**, you must specify **link**, **fileName**, and **fileType**.
*   If you set **messageType** to **text_button**, you must specify **text**, **caption**, and **action**.
*   If you set **messageType** to **text_image_button**, you must specify **text**, **link**, **caption**, and **action**.
*   If you set **messageType** to **text_video**, you must specify **text**, **link**, **thumbnail**, **fileSize**, and **duration**.
*   If you set **messageType** to **text_video_button**, you must specify **text**, **link**, **thumbnail**, **fileSize**, **duration**, and **caption**. In addition, you must not specify **action**.', example='{\\\\"text\\\\": \\\\"hello whatsapp\\\\", \\\\"link\\\\": \\\\"\\\\", \\\\"caption\\\\": \\\\"\\\\", \\\\"fileName\\\\": \\\\"\\\\" }'),
  contextMessageId?: string(name='ContextMessageId', description='The ID of the reply message.', example='61851ccb2f1365b16aee****'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user.', example='28251486512358****'),
  custWabaId?: string(name='CustWabaId', description='The WhatsApp Business Account (WABA) ID of the RAM user within the independent software vendor (ISV) account.

>  CustWabaId is an obsolete parameter. Use CustSpaceId instead.', example='65921621816****', deprecated=true),
  fallBackContent?: string(name='FallBackContent', description='The content of the fallback message.', example='This is a fallback message.'),
  fallBackDuration?: int32(name='FallBackDuration', description='Specifies the period of time after which the fallback message is sent if the message receipt that indicates the message is delivered to clients is not received. If this parameter is left empty, the fallback message is sent only when the **message fails to be sent** or **the message receipt that indicates the message is not delivered to clients** is received. Unit: seconds. Valid values: 60 to 43200.', example='120'),
  fallBackId?: string(name='FallBackId', description='The ID of the fallback policy. You can create a fallback policy and view the information in the Chat App Message Service console.', example='S_000001'),
  fallBackRule?: string(name='FallBackRule', description='The fallback rule. Valid values:

*   **undelivered**: A fallback is triggered if the message is not delivered to clients. When the message is being sent, the template parameters are verified. If the parameters fail to pass the verification, the message fails to be sent. Whether the template and phone number are prohibited is not verified. By default, this value is used when FallBackRule is left empty.
*   **sentFailed**: A fallback is triggered even if the template parameters including variables fail to pass the verification. If the channelType, type, messageType, to, and from parameters fail to pass the verification, a fallback is not triggered.', example='undelivered'),
  flowActionShrink?: string(name='FlowAction', description='The Flow action.'),
  from?: string(name='From', description='The mobile phone number of the message sender.

>  You can specify a mobile phone number that is registered for a WhatsApp account and is approved in the Chat App Message Service console.

This parameter is required.', example='1360000****'),
  isvCode?: string(name='IsvCode', description='The ISV verification code. This parameter is used to verify whether the RAM user is authorized by the ISV account.', example='skdi3kksloslikdkkdk'),
  label?: string(name='Label', description='The type of the Viber message. This parameter is required if ChannelType is set to viber. Valid values:

*   **promotion**
*   **transaction**', example='promotion'),
  language?: string(name='Language', description='The language that is used in the message template. This parameter is required only if you set the Type parameter to **template**. For more information about language codes, see [Language codes](https://help.aliyun.com/document_detail/463420.html).', example='en'),
  messageType?: string(name='MessageType', description='The specific type of the message. This parameter is required only if you set the Type parameter to **message**.

**Valid values of MessageType when you set the ChannelType parameter to whatsapp:**

*   **text**: a text message.
*   **image**: an image message.
*   **video**: a video message.
*   **audio**: an audio message.
*   **document**: a document message.
*   **interactive**: an interactive message.
*   **contacts**: a contact message.
*   **location**: a location message.
*   **sticker**: a sticker message.
*   **reaction**: a reaction message.

**Valid values of MessageType when you set the ChannelType parameter to viber:**

*   **text**: a text message.
*   **image**: an image message.
*   **video**: a video message.
*   **document**: a document message.
*   **text_button**: a message that contains the text and button media objects.
*   **text_image_button**: a message that contains multiple media objects, including the text, image, and button.
*   **text_video**: a message that contains the text and video media objects.
*   **text_video_button**: a message that contains multiple media objects, including text, video, and button.
*   **text_image**: a message that contains the text and image media objects.

> For more information, see [Parameters of a message template](https://help.aliyun.com/document_detail/454530.html).', example='text'),
  payloadShrink?: string(name='Payload', description='The payload of the button.', example='payloadtext1,payloadtext2,payloadtext3'),
  productActionShrink?: string(name='ProductAction', description='The information about the products included in the WhatsApp catalog message or multi-product message (MPM).'),
  tag?: string(name='Tag', description='The tag information of the Viber message.', example='tag'),
  taskId?: string(name='TaskId', description='The task ID.', example='100000001'),
  templateCode?: string(name='TemplateCode', description='The code of the message template. This parameter is required only if you set the Type parameter to **template**.', example='744c4b5c79c9432497a075bdfca3****'),
  templateName?: string(name='TemplateName', description='The name of the message template.', example='test_name'),
  templateParamsShrink?: string(name='TemplateParams', description='The variables of the message template.'),
  to?: string(name='To', description='The mobile phone number of the message receiver.

This parameter is required.', example='1390000****'),
  trackingData?: string(name='TrackingData', description='The tracking data of the Viber message.', example='tracking_id:123456'),
  ttl?: int32(name='Ttl', description='The timeout period for sending the Viber message. Valid values: 30 to 1209600. Unit: seconds.', example='50'),
  type?: string(name='Type', description='The message type. Valid values:

*   **template**: the template message. A template message is sent based on a template that is created and approved in the Chat App Message Service console. You can send template messages based on your business requirements.
*   **message**: the custom message. You can send a custom WhatsApp message to a user only within 24 hours after you receive the last message from the user. This limit does not apply to custom Viber messages.

This parameter is required.', example='template'),
}

model SendChatappMessageResponseBody = {
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='User not authorized to operate on the specified resource.'),
  messageId?: string(name='MessageId', description='The ID of the message that was sent.', example='61851ccb2f1365b16aee****'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model SendChatappMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SendChatappMessageResponseBody(name='body'),
}

/**
 * @summary Sends messages by using ChatAPP.
 *
 * @description You can call this operation up to 200 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq SendChatappMessageRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SendChatappMessageResponse
 */
async function sendChatappMessageWithOptions(tmpReq: SendChatappMessageRequest, runtime: $RuntimeOptions): SendChatappMessageResponse {
  tmpReq.validate();
  var request = new SendChatappMessageShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.flowAction)) {
    request.flowActionShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.flowAction, 'FlowAction', 'json');
  }
  if (!$isNull(tmpReq.payload)) {
    request.payloadShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.payload, 'Payload', 'json');
  }
  if (!$isNull(tmpReq.productAction)) {
    request.productActionShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.productAction, 'ProductAction', 'json');
  }
  if (!$isNull(tmpReq.templateParams)) {
    request.templateParamsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.templateParams, 'TemplateParams', 'json');
  }
  var query = {};
  if (!$isNull(request.content)) {
    query['Content'] = request.content;
  }
  if (!$isNull(request.payloadShrink)) {
    query['Payload'] = request.payloadShrink;
  }
  var body : map[string]any = {};
  if (!$isNull(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!$isNull(request.contextMessageId)) {
    body['ContextMessageId'] = request.contextMessageId;
  }
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.custWabaId)) {
    body['CustWabaId'] = request.custWabaId;
  }
  if (!$isNull(request.fallBackContent)) {
    body['FallBackContent'] = request.fallBackContent;
  }
  if (!$isNull(request.fallBackDuration)) {
    body['FallBackDuration'] = request.fallBackDuration;
  }
  if (!$isNull(request.fallBackId)) {
    body['FallBackId'] = request.fallBackId;
  }
  if (!$isNull(request.fallBackRule)) {
    body['FallBackRule'] = request.fallBackRule;
  }
  if (!$isNull(request.flowActionShrink)) {
    body['FlowAction'] = request.flowActionShrink;
  }
  if (!$isNull(request.from)) {
    body['From'] = request.from;
  }
  if (!$isNull(request.isvCode)) {
    body['IsvCode'] = request.isvCode;
  }
  if (!$isNull(request.label)) {
    body['Label'] = request.label;
  }
  if (!$isNull(request.language)) {
    body['Language'] = request.language;
  }
  if (!$isNull(request.messageType)) {
    body['MessageType'] = request.messageType;
  }
  if (!$isNull(request.productActionShrink)) {
    body['ProductAction'] = request.productActionShrink;
  }
  if (!$isNull(request.tag)) {
    body['Tag'] = request.tag;
  }
  if (!$isNull(request.taskId)) {
    body['TaskId'] = request.taskId;
  }
  if (!$isNull(request.templateCode)) {
    body['TemplateCode'] = request.templateCode;
  }
  if (!$isNull(request.templateName)) {
    body['TemplateName'] = request.templateName;
  }
  if (!$isNull(request.templateParamsShrink)) {
    body['TemplateParams'] = request.templateParamsShrink;
  }
  if (!$isNull(request.to)) {
    body['To'] = request.to;
  }
  if (!$isNull(request.trackingData)) {
    body['TrackingData'] = request.trackingData;
  }
  if (!$isNull(request.ttl)) {
    body['Ttl'] = request.ttl;
  }
  if (!$isNull(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'SendChatappMessage',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Sends messages by using ChatAPP.
 *
 * @description You can call this operation up to 200 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request SendChatappMessageRequest
 * @return SendChatappMessageResponse
 */
async function sendChatappMessage(request: SendChatappMessageRequest): SendChatappMessageResponse {
  var runtime = new $RuntimeOptions{};
  return sendChatappMessageWithOptions(request, runtime);
}

model SubmitIsvCustomerTermsRequest {
  businessDesc?: string(name='BusinessDesc', description='The business scenario.

This parameter is required.', example='Marketing products'),
  contactMail?: string(name='ContactMail', description='The enterprise mail.

This parameter is required.', example='partner@aliyun.com'),
  countryId?: string(name='CountryId', description='The country code.

>  For more information about country codes, see [Country codes](https://help.aliyun.com/document_detail/608210.html).

This parameter is required.', example='CN'),
  custName?: string(name='CustName', description='The enterprise name.

This parameter is required.', example='Aliyun'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493'),
  isvTerms?: string(name='IsvTerms', description='The ISV or Client agreement.

This parameter is required.', example='isvTerms.pdf'),
  officeAddress?: string(name='OfficeAddress', description='The enterprise address.

This parameter is required.', example='Hangzhou'),
}

model SubmitIsvCustomerTermsResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='/'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='OK'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model SubmitIsvCustomerTermsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SubmitIsvCustomerTermsResponseBody(name='body'),
}

/**
 * @summary Submits the agreement information for independent software vendor (ISV) customers.
 *
 * @description *   You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * *   After you call the [GetChatappUploadAuthorization](~~GetChatappUploadAuthorization~~) operation to obtain the authentication information for uploading the file to Object Storage Service (OSS), you can use the authentication information to upload the file to the OSS server. To upload the file, you can call the SDK provided by OSS. When you upload the file, set the value of the key to the value of `Dir + "/" + file name`, such as C200293990209/isvTerms.pdf. The value of Dir is obtained from the [GetChatappUploadAuthorization](~~GetChatappUploadAuthorization~~) operation. The value of IsvTerms is obtained from the PutObject operation.
 *
 * @param request SubmitIsvCustomerTermsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SubmitIsvCustomerTermsResponse
 */
async function submitIsvCustomerTermsWithOptions(request: SubmitIsvCustomerTermsRequest, runtime: $RuntimeOptions): SubmitIsvCustomerTermsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.businessDesc)) {
    query['BusinessDesc'] = request.businessDesc;
  }
  if (!$isNull(request.contactMail)) {
    query['ContactMail'] = request.contactMail;
  }
  if (!$isNull(request.countryId)) {
    query['CountryId'] = request.countryId;
  }
  if (!$isNull(request.custName)) {
    query['CustName'] = request.custName;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.isvTerms)) {
    query['IsvTerms'] = request.isvTerms;
  }
  if (!$isNull(request.officeAddress)) {
    query['OfficeAddress'] = request.officeAddress;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SubmitIsvCustomerTerms',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Submits the agreement information for independent software vendor (ISV) customers.
 *
 * @description *   You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * *   After you call the [GetChatappUploadAuthorization](~~GetChatappUploadAuthorization~~) operation to obtain the authentication information for uploading the file to Object Storage Service (OSS), you can use the authentication information to upload the file to the OSS server. To upload the file, you can call the SDK provided by OSS. When you upload the file, set the value of the key to the value of `Dir + "/" + file name`, such as C200293990209/isvTerms.pdf. The value of Dir is obtained from the [GetChatappUploadAuthorization](~~GetChatappUploadAuthorization~~) operation. The value of IsvTerms is obtained from the PutObject operation.
 *
 * @param request SubmitIsvCustomerTermsRequest
 * @return SubmitIsvCustomerTermsResponse
 */
async function submitIsvCustomerTerms(request: SubmitIsvCustomerTermsRequest): SubmitIsvCustomerTermsResponse {
  var runtime = new $RuntimeOptions{};
  return submitIsvCustomerTermsWithOptions(request, runtime);
}

model TriggerChatFlowRequest {
  claimTimeMillis?: long(name='ClaimTimeMillis', description='The declared occurrence time of the event, usually the time when the request was constructed, in milliseconds timestamp.', example='1731502129000'),
  data?: map[string]any(name='Data', description='Input parameters in Key-Value format. The Key must match the input strategy configured at the start node of your flow.', example='{"my_biz_data_0": "hi", "my_biz_data_1": "1024"}'),
  discardTimeMillis?: long(name='DiscardTimeMillis', description='The time when the event should be discarded, i.e., the expiration time. If this field is specified, the message will be discarded if it exceeds this time, in milliseconds timestamp.', example='1731502729000'),
  flowCode?: string(name='FlowCode', description='Flow code.

This parameter is required.', example='f4912c16943b4dfba44bd6fedacf8c70'),
  outId?: string(name='OutId', description='External system transaction number, used to associate with external business system transactions. You can retrieve this parameter within the flow after triggering.', example='8d4acf7e-e360-eb83-6d74-fcf9c4538fda'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  uuid?: string(name='Uuid', description='Unique event ID used for idempotent triggers. Do not include any business semantics; you can retrieve this parameter within the flow after triggering.', example='c68622e6-5f0d-c8a4-af41-e949c2a7580e'),
}

model TriggerChatFlowShrinkRequest {
  claimTimeMillis?: long(name='ClaimTimeMillis', description='The declared occurrence time of the event, usually the time when the request was constructed, in milliseconds timestamp.', example='1731502129000'),
  dataShrink?: string(name='Data', description='Input parameters in Key-Value format. The Key must match the input strategy configured at the start node of your flow.', example='{"my_biz_data_0": "hi", "my_biz_data_1": "1024"}'),
  discardTimeMillis?: long(name='DiscardTimeMillis', description='The time when the event should be discarded, i.e., the expiration time. If this field is specified, the message will be discarded if it exceeds this time, in milliseconds timestamp.', example='1731502729000'),
  flowCode?: string(name='FlowCode', description='Flow code.

This parameter is required.', example='f4912c16943b4dfba44bd6fedacf8c70'),
  outId?: string(name='OutId', description='External system transaction number, used to associate with external business system transactions. You can retrieve this parameter within the flow after triggering.', example='8d4acf7e-e360-eb83-6d74-fcf9c4538fda'),
  ownerId?: long(name='OwnerId'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  uuid?: string(name='Uuid', description='Unique event ID used for idempotent triggers. Do not include any business semantics; you can retrieve this parameter within the flow after triggering.', example='c68622e6-5f0d-c8a4-af41-e949c2a7580e'),
}

model TriggerChatFlowResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='Details of access denial', example='无'),
  code?: string(name='Code', description='Status code.', example='无'),
  data?: map[string]any(name='Data', description='Returned data.', example='{}'),
  message?: string(name='Message', description='Error description message.', example='无'),
  requestId?: string(name='RequestId', description='Request ID.', example='无'),
  success?: boolean(name='Success', description='Whether the call was successful.
- **true**: Call succeeded.
- **false**: Call failed.', example='true'),
}

model TriggerChatFlowResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TriggerChatFlowResponseBody(name='body'),
}

/**
 * @summary Trigger an Online ChatFlow
 *
 * @description After triggering an online flow, if your flow contains components that incur costs for cloud products, such as message sending or function calls, please ensure you fully understand the billing methods and prices of the related products before using this interface.
 *
 * @param tmpReq TriggerChatFlowRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TriggerChatFlowResponse
 */
async function triggerChatFlowWithOptions(tmpReq: TriggerChatFlowRequest, runtime: $RuntimeOptions): TriggerChatFlowResponse {
  tmpReq.validate();
  var request = new TriggerChatFlowShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.data)) {
    request.dataShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.data, 'Data', 'json');
  }
  var query = {};
  if (!$isNull(request.claimTimeMillis)) {
    query['ClaimTimeMillis'] = request.claimTimeMillis;
  }
  if (!$isNull(request.dataShrink)) {
    query['Data'] = request.dataShrink;
  }
  if (!$isNull(request.discardTimeMillis)) {
    query['DiscardTimeMillis'] = request.discardTimeMillis;
  }
  if (!$isNull(request.flowCode)) {
    query['FlowCode'] = request.flowCode;
  }
  if (!$isNull(request.outId)) {
    query['OutId'] = request.outId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!$isNull(request.uuid)) {
    query['Uuid'] = request.uuid;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'TriggerChatFlow',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Trigger an Online ChatFlow
 *
 * @description After triggering an online flow, if your flow contains components that incur costs for cloud products, such as message sending or function calls, please ensure you fully understand the billing methods and prices of the related products before using this interface.
 *
 * @param request TriggerChatFlowRequest
 * @return TriggerChatFlowResponse
 */
async function triggerChatFlow(request: TriggerChatFlowRequest): TriggerChatFlowResponse {
  var runtime = new $RuntimeOptions{};
  return triggerChatFlowWithOptions(request, runtime);
}

model UpdateAccountWebhookRequest {
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493**'),
  httpFlag?: string(name='HttpFlag', description='Specifies whether to use HTTP callbacks to receive message receipts. Valid values:

*   Y: indicates that HTTP callbacks are used to receive receipts.
*   N: indicates that HTTP callbacks are not used to receive receipts.', example='Y'),
  queueFlag?: string(name='QueueFlag', description='Specifies whether to use Message Service (MNS) queues to receive receipts. Valid values:

*   Y: indicates that MNS queues are used to receive receipts.
*   N: indicates that MNS queues are not used to receive receipts.', example='N'),
  statusCallbackUrl?: string(name='StatusCallbackUrl', description='The callback URL to which status reports are sent by using HTTP callbacks.', example='http://www.aliyun.com'),
}

model UpdateAccountWebhookResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message returned.', example='SUCCESS'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='744c4b5c79c9432497a075bdfca3****'),
}

model UpdateAccountWebhookResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateAccountWebhookResponseBody(name='body'),
}

/**
 * @summary Modifies the callback URL of an account.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UpdateAccountWebhookRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateAccountWebhookResponse
 */
async function updateAccountWebhookWithOptions(request: UpdateAccountWebhookRequest, runtime: $RuntimeOptions): UpdateAccountWebhookResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.httpFlag)) {
    query['HttpFlag'] = request.httpFlag;
  }
  if (!$isNull(request.queueFlag)) {
    query['QueueFlag'] = request.queueFlag;
  }
  if (!$isNull(request.statusCallbackUrl)) {
    query['StatusCallbackUrl'] = request.statusCallbackUrl;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateAccountWebhook',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the callback URL of an account.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UpdateAccountWebhookRequest
 * @return UpdateAccountWebhookResponse
 */
async function updateAccountWebhook(request: UpdateAccountWebhookRequest): UpdateAccountWebhookResponse {
  var runtime = new $RuntimeOptions{};
  return updateAccountWebhookWithOptions(request, runtime);
}

model UpdateCommerceSettingRequest {
  cartEnable?: boolean(name='CartEnable', description='Specifies whether to display the shopping cart button. Valid values:

*   true
*   false

This parameter is required.', example='true'),
  catalogVisible?: boolean(name='CatalogVisible', description='Specifies whether to display the catalog button. Valid values:

*   true
*   false

This parameter is required.', example='false'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the user within the independent software vendor (ISV) account.

This parameter is required.', example='293483938849493'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='1380000****'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model UpdateCommerceSettingResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   Other values indicate that the request failed. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model UpdateCommerceSettingResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateCommerceSettingResponseBody(name='body'),
}

/**
 * @summary Modifies the business settings of a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UpdateCommerceSettingRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateCommerceSettingResponse
 */
async function updateCommerceSettingWithOptions(request: UpdateCommerceSettingRequest, runtime: $RuntimeOptions): UpdateCommerceSettingResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.cartEnable)) {
    query['CartEnable'] = request.cartEnable;
  }
  if (!$isNull(request.catalogVisible)) {
    query['CatalogVisible'] = request.catalogVisible;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateCommerceSetting',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the business settings of a phone number.
 *
 * @description You can call this operation up to 10 times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UpdateCommerceSettingRequest
 * @return UpdateCommerceSettingResponse
 */
async function updateCommerceSetting(request: UpdateCommerceSettingRequest): UpdateCommerceSettingResponse {
  var runtime = new $RuntimeOptions{};
  return updateCommerceSettingWithOptions(request, runtime);
}

model UpdateConversationalAutomationRequest {
  commands?: [ 
    {
      commandDescription?: string(name='CommandDescription', description='The description of the command.', example='Command 1.'),
      commandName?: string(name='CommandName', description='The command name.', example='test'),
    }
  ](name='Commands', description='The commands.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account or the instance ID of the customer of Alibaba Cloud.

This parameter is required.', example='2993****'),
  enableWelcomeMessage?: boolean(name='EnableWelcomeMessage', description='Specifies whether to enable the welcoming message.', example='true'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number of the enterprise.

This parameter is required.', example='86130000***'),
  prompts?: [ string ](name='Prompts', description='The opening remarks.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model UpdateConversationalAutomationShrinkRequest {
  commandsShrink?: string(name='Commands', description='The commands.'),
  custSpaceId?: string(name='CustSpaceId', description='The space ID of the RAM user within the independent software vendor (ISV) account or the instance ID of the customer of Alibaba Cloud.

This parameter is required.', example='2993****'),
  enableWelcomeMessage?: boolean(name='EnableWelcomeMessage', description='Specifies whether to enable the welcoming message.', example='true'),
  ownerId?: long(name='OwnerId'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number of the enterprise.

This parameter is required.', example='86130000***'),
  promptsShrink?: string(name='Prompts', description='The opening remarks.'),
  resourceOwnerAccount?: string(name='ResourceOwnerAccount'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model UpdateConversationalAutomationResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='The details about the access denial.', example='None'),
  code?: string(name='Code', description='The response code.

*   The value OK indicates that the request was successful.
*   For more information about other response codes, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='The error message.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
  success?: boolean(name='Success', description='Indicates whether the request was successful. Valid values:

*   **true**
*   **false**', example='true'),
}

model UpdateConversationalAutomationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateConversationalAutomationResponseBody(name='body'),
}

/**
 * @summary Modifies welcoming messages, opening remarks, and commands for a phone number.
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * This operation will directly obtain data from Facebook, which sets an upper limit on the total number of calls for operations. We recommend that you take note of the limit when you call this operation.
 *
 * @param tmpReq UpdateConversationalAutomationRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateConversationalAutomationResponse
 */
async function updateConversationalAutomationWithOptions(tmpReq: UpdateConversationalAutomationRequest, runtime: $RuntimeOptions): UpdateConversationalAutomationResponse {
  tmpReq.validate();
  var request = new UpdateConversationalAutomationShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.commands)) {
    request.commandsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.commands, 'Commands', 'json');
  }
  if (!$isNull(tmpReq.prompts)) {
    request.promptsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.prompts, 'Prompts', 'json');
  }
  var query = {};
  if (!$isNull(request.commandsShrink)) {
    query['Commands'] = request.commandsShrink;
  }
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.enableWelcomeMessage)) {
    query['EnableWelcomeMessage'] = request.enableWelcomeMessage;
  }
  if (!$isNull(request.ownerId)) {
    query['OwnerId'] = request.ownerId;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.promptsShrink)) {
    query['Prompts'] = request.promptsShrink;
  }
  if (!$isNull(request.resourceOwnerAccount)) {
    query['ResourceOwnerAccount'] = request.resourceOwnerAccount;
  }
  if (!$isNull(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateConversationalAutomation',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies welcoming messages, opening remarks, and commands for a phone number.
 *
 * @description ### [](#qps-)QPS limit
 * You can call this operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.
 * This operation will directly obtain data from Facebook, which sets an upper limit on the total number of calls for operations. We recommend that you take note of the limit when you call this operation.
 *
 * @param request UpdateConversationalAutomationRequest
 * @return UpdateConversationalAutomationResponse
 */
async function updateConversationalAutomation(request: UpdateConversationalAutomationRequest): UpdateConversationalAutomationResponse {
  var runtime = new $RuntimeOptions{};
  return updateConversationalAutomationWithOptions(request, runtime);
}

model UpdateFlowJSONAssetRequest {
  custSpaceId?: string(name='CustSpaceId', description='SpaceId/instance ID of ISV sub customer.', example='9399393'),
  filePath?: string(name='FilePath', description='JSON file generated according to Facebook flow rules.

This parameter is required.', example='https://aliyun/json.json'),
  flowId?: string(name='FlowId', description='The Flow ID.

This parameter is required.', example='flow_001'),
}

model UpdateFlowJSONAssetResponseBody = {
  code?: string(name='Code', description='The result returns OK as normal.', example='OK'),
  data?: {
    flowId?: string(name='FlowId', description='The Flow ID.', example='84848847****'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='Error description information.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model UpdateFlowJSONAssetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateFlowJSONAssetResponseBody(name='body'),
}

/**
 * @summary Updates a Flow by using JSON content.
 *
 * @param request UpdateFlowJSONAssetRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateFlowJSONAssetResponse
 */
async function updateFlowJSONAssetWithOptions(request: UpdateFlowJSONAssetRequest, runtime: $RuntimeOptions): UpdateFlowJSONAssetResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.filePath)) {
    body['FilePath'] = request.filePath;
  }
  if (!$isNull(request.flowId)) {
    body['FlowId'] = request.flowId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateFlowJSONAsset',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates a Flow by using JSON content.
 *
 * @param request UpdateFlowJSONAssetRequest
 * @return UpdateFlowJSONAssetResponse
 */
async function updateFlowJSONAsset(request: UpdateFlowJSONAssetRequest): UpdateFlowJSONAssetResponse {
  var runtime = new $RuntimeOptions{};
  return updateFlowJSONAssetWithOptions(request, runtime);
}

model UpdatePhoneEncryptionPublicKeyRequest {
  custSpaceId?: string(name='CustSpaceId', description='SpaceId/instanceId of ISV sub clients.', example='399382882'),
  encryptionPublicKey?: string(name='EncryptionPublicKey', description='Encrypt the public key.

This parameter is required.', example='-----BEGIN PUBLIC KEY-----
AAA
BBB
CCC
DDD
EEE
FFF
GGG
-----END PUBLIC KEY-----'),
  phoneNumber?: string(name='PhoneNumber', description='The phone number.

This parameter is required.', example='86138000'),
}

model UpdatePhoneEncryptionPublicKeyResponseBody = {
  code?: string(name='Code', description='The result returns OK as normal.', example='OK'),
  message?: string(name='Message', description='Error description information.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A94866411B2O'),
}

model UpdatePhoneEncryptionPublicKeyResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdatePhoneEncryptionPublicKeyResponseBody(name='body'),
}

/**
 * @summary Updates the encryption public key of a phone number.
 *
 * @param request UpdatePhoneEncryptionPublicKeyRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdatePhoneEncryptionPublicKeyResponse
 */
async function updatePhoneEncryptionPublicKeyWithOptions(request: UpdatePhoneEncryptionPublicKeyRequest, runtime: $RuntimeOptions): UpdatePhoneEncryptionPublicKeyResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.encryptionPublicKey)) {
    body['EncryptionPublicKey'] = request.encryptionPublicKey;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdatePhoneEncryptionPublicKey',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates the encryption public key of a phone number.
 *
 * @param request UpdatePhoneEncryptionPublicKeyRequest
 * @return UpdatePhoneEncryptionPublicKeyResponse
 */
async function updatePhoneEncryptionPublicKey(request: UpdatePhoneEncryptionPublicKeyRequest): UpdatePhoneEncryptionPublicKeyResponse {
  var runtime = new $RuntimeOptions{};
  return updatePhoneEncryptionPublicKeyWithOptions(request, runtime);
}

model UpdatePhoneMessageQrdlRequest {
  custSpaceId?: string(name='CustSpaceId', description='SpaceId/instance ID of ISV sub customer.', example='9383884'),
  generateQrImage?: string(name='GenerateQrImage', description='Produce QR code image format.

This parameter is required.', example='PNG'),
  phoneNumber?: string(name='PhoneNumber', description='Number, enter the country/region code+number.

This parameter is required.', example='861380000'),
  prefilledMessage?: string(name='PrefilledMessage', description='Message content.

This parameter is required.', example='Hello'),
  qrdlCode?: string(name='QrdlCode', description='QR code encoding.

This parameter is required.', example='29338838'),
}

model UpdatePhoneMessageQrdlResponseBody = {
  code?: string(name='Code', description='The result returns OK as normal.', example='OK'),
  data?: {
    deepLinkUrl?: string(name='DeepLinkUrl', description='Deep link address.', example='https://wa.msg/'),
    generateQrImage?: string(name='GenerateQrImage', description='Generate image types.', example='PNG'),
    phoneNumber?: string(name='PhoneNumber', description='Number.', example='8613800'),
    prefilledMessage?: string(name='PrefilledMessage', description='Message content.', example='Hello'),
    qrImageUrl?: string(name='QrImageUrl', description='QR code address.', example='https://img.png'),
    qrdlCode?: string(name='QrdlCode', description='QR code encoding.', example='DEDEE998'),
  }(name='Data', description='The returned data.'),
  message?: string(name='Message', description='Error description information.', example='None'),
  requestId?: string(name='RequestId', description='The request ID.', example='1612C226-E271-4CFE-9F18-4066D******'),
}

model UpdatePhoneMessageQrdlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdatePhoneMessageQrdlResponseBody(name='body'),
}

/**
 * @summary Modifies a quick-response (QR) code that contains a message.
 *
 * @param request UpdatePhoneMessageQrdlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdatePhoneMessageQrdlResponse
 */
async function updatePhoneMessageQrdlWithOptions(request: UpdatePhoneMessageQrdlRequest, runtime: $RuntimeOptions): UpdatePhoneMessageQrdlResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.custSpaceId)) {
    body['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.generateQrImage)) {
    body['GenerateQrImage'] = request.generateQrImage;
  }
  if (!$isNull(request.phoneNumber)) {
    body['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.prefilledMessage)) {
    body['PrefilledMessage'] = request.prefilledMessage;
  }
  if (!$isNull(request.qrdlCode)) {
    body['QrdlCode'] = request.qrdlCode;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdatePhoneMessageQrdl',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a quick-response (QR) code that contains a message.
 *
 * @param request UpdatePhoneMessageQrdlRequest
 * @return UpdatePhoneMessageQrdlResponse
 */
async function updatePhoneMessageQrdl(request: UpdatePhoneMessageQrdlRequest): UpdatePhoneMessageQrdlResponse {
  var runtime = new $RuntimeOptions{};
  return updatePhoneMessageQrdlWithOptions(request, runtime);
}

model UpdatePhoneWebhookRequest {
  custSpaceId?: string(name='CustSpaceId', description='SpaceId for ISV sub clients.

This parameter is required.', example='293483938849493****'),
  httpFlag?: string(name='HttpFlag', description='Whether to use HTTP to receive receipts. Value:
*   Y: Yes.
*   N: No.', example='Y'),
  phoneNumber?: string(name='PhoneNumber', description='phone number.

This parameter is required.', example='8613800001234'),
  queueFlag?: string(name='QueueFlag', description='Whether to use queue method to receive receipts. Value:
*   Y: Yes.
*   N: No.', example='N'),
  statusCallbackUrl?: string(name='StatusCallbackUrl', description='HTTP status report interface callback address.', example='http://www.aliyun.com'),
  upCallbackUrl?: string(name='UpCallbackUrl', description='HTTP upstream message interface callback address.', example='http://aliyun.com'),
}

model UpdatePhoneWebhookResponseBody = {
  accessDeniedDetail?: string(name='AccessDeniedDetail', description='Access denied for detailed information.', example='None'),
  code?: string(name='Code', description='The HTTP status code returned.

*   A value of OK indicates that the call is successful.
*   Other values indicate that the call fails. For more information, see [Error codes](https://help.aliyun.com/document_detail/196974.html).', example='OK'),
  message?: string(name='Message', description='Prompt message, there is a value when an exception is returned.', example='null'),
  requestId?: string(name='RequestId', description='The request ID.', example='90E63D28-E31D-1EB2-8939-A9486641****'),
}

model UpdatePhoneWebhookResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdatePhoneWebhookResponseBody(name='body'),
}

/**
 * @summary The HTTP status code returned.
 * \\*   A value of OK indicates that the call is successful.
 * \\*   Other values indicate that the call fails. For more information, see [Error codes]\\(~~196974~~).
 *
 * @description The error message returned.
 *
 * @param request UpdatePhoneWebhookRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdatePhoneWebhookResponse
 */
async function updatePhoneWebhookWithOptions(request: UpdatePhoneWebhookRequest, runtime: $RuntimeOptions): UpdatePhoneWebhookResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.custSpaceId)) {
    query['CustSpaceId'] = request.custSpaceId;
  }
  if (!$isNull(request.httpFlag)) {
    query['HttpFlag'] = request.httpFlag;
  }
  if (!$isNull(request.phoneNumber)) {
    query['PhoneNumber'] = request.phoneNumber;
  }
  if (!$isNull(request.queueFlag)) {
    query['QueueFlag'] = request.queueFlag;
  }
  if (!$isNull(request.statusCallbackUrl)) {
    query['StatusCallbackUrl'] = request.statusCallbackUrl;
  }
  if (!$isNull(request.upCallbackUrl)) {
    query['UpCallbackUrl'] = request.upCallbackUrl;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdatePhoneWebhook',
    version = '2020-06-06',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The HTTP status code returned.
 * \\*   A value of OK indicates that the call is successful.
 * \\*   Other values indicate that the call fails. For more information, see [Error codes]\\(~~196974~~).
 *
 * @description The error message returned.
 *
 * @param request UpdatePhoneWebhookRequest
 * @return UpdatePhoneWebhookResponse
 */
async function updatePhoneWebhook(request: UpdatePhoneWebhookRequest): UpdatePhoneWebhookResponse {
  var runtime = new $RuntimeOptions{};
  return updatePhoneWebhookWithOptions(request, runtime);
}

